A scaffolding repository to speed up the launch of new application development.
Variable names and example values:
REPO:reearth/scaffoldIMAGE_SERVER:ghcr.io/reearth/scaffold/scaffold-webIMAGE_WEB:ghcr.io/reearth/scaffold/scaffold-apiREGION:asia-northeast1SERVICE_NAME_API:reearth-scaffold-apiSERVICE_NAME_WEB:reearth-scaffold-web
Secrets (organization secrets are also OK):
GCP_PROJECT_IDGCP_SA_EMAILGCP_WORKLOAD_IDENTITY_PROVIDERGH_APP_IDGH_APP_PRIVATE_KEYGH_APP_USERDOCKERHUB_USERNAME(if needed)DOCKERHUB_TOKEN(if needed)
Do not fork this repository. Init a new repository on GitHub and just copy files in this repository to it.
-
server/go.modRename this to your new module name.
module github.com/reearth/scaffold/server -
web/index.html<title>Vite + React + TS</title>
-
web/package.json{ "name": "scaffold" // EDIT // ... } -
terraform/reearth_scaffold_{api,web}Rename these directories.
-
terraform/reearth_scaffold_{api,web}/locals.tfEdit a local:
service_name. -
**/README.md -
**/*.goReplace import statements in each go files to your new module name. It's good to run
go mod tidyafter renaming.import ( "github.com/reearth/scaffold/server/foobar" // -> "<YOUR MODULE NAME>/server/foobar" )
Ensure Docker images have been saved at a registry. Deployment will fail, but don't worry, as long as CI is successful.
Initialize the modules for API and Web using standard terraform module GitHub source
For example:
- API:
module "reearth_scaffold_api" {
source = "github.com/reearth/scaffold//terraform/reearth_scaffold_api?ref=main"
auth0_domain = local.auth0_domain
auth0_audience = local.auth0_audience
database_secret_id = google_secret_manager_secret.reearth_db.secret_id
domain = local.test_domain
image = "${google_artifact_registry_repository.reearth.location}-docker.pkg.dev/${google_artifact_registry_repository.reearth.project}/${google_artifact_registry_repository.reearth.name}/reearth-scaffold-api:latest"
project = module.starter_kit.gcp_project_id
region = "us-central1"
service_account_email = google_service_account.reearth_scaffold_api.email
}- Web:
module "reearth_scaffold_web" {
source = "github.com/reearth/scaffold//terraform/reearth_scaffold_web?ref=main"
auth0_client_id = local.auth0_client_id
auth0_domain = local.auth0_domain
auth0_audience = local.auth0_audience
image = "${google_artifact_registry_repository.reearth.location}-docker.pkg.dev/${google_artifact_registry_repository.reearth.project}/${google_artifact_registry_repository.reearth.name}/reearth-scaffold-web:latest"
project = module.starter_kit.gcp_project_id
region = "us-central1"
service_account_email = google_service_account.reearth_scaffold_web.email
}Make sure the deployment workflows are successful.