-
Clone repository di cloud shell
git clone https://github.com/googlecodelabs/monolith-to-microservices.git cd ~/monolith-to-microservices
-
install dependensi nodeJS
./setup.sh
-
Jalankan aplikasi
cd ~/monolith-to-microservices/monolith npm start
-
Lihat aplikasi di preview web (Preview on port 8080)
-
Di navigasi menu, pilih Artifact Registry > Repositories.
-
Buat repository baru dengan nama monolith-demo
-
Pilih Docker sebagai format dan pilih Region us-central1
- Command untuk mengonfigurasikan autentikasi ke repositori Docker di region us-central1
gcloud auth configure-docker us-central1-docker.pkg.dev
-
Enable Cloud Build API
gcloud services enable artifactregistry.googleapis.com \ cloudbuild.googleapis.com \ run.googleapis.com
-
Start the build
gcloud builds submit --tag us-central1-docker.pkg.dev/${GOOGLE_CLOUD_PROJECT}/monolith-demo/monolith:1.0.0
-
Untuk melihat history build, pilih CI/CD > Cloud Build > History
- Deploy container ke Cloud Run
gcloud run deploy monolith --image us-central1-docker.pkg.dev/${GOOGLE_CLOUD_PROJECT}/monolith-demo/monolith:1.0.0 --region us-central1
- Untuk memverifikasi deployment
gcloud run services list
-
re-deploy container dengan concurrency 1
gcloud run deploy monolith --image us-central1-docker.pkg.dev/${GOOGLE_CLOUD_PROJECT}/monolith-demo/monolith:1.0.0 --region us-central1 --concurrency 1
-
Untuk melihat detail, pilih di Navigation Menu > Cloud Run > monolith > Revisions
-
re-deploy container dengan concurrency 80
gcloud run deploy monolith --image us-central1-docker.pkg.dev/${GOOGLE_CLOUD_PROJECT}/monolith-demo/monolith:1.0.0 --region us-central1 --concurrency 80
-
Mengubah tampilan homepage website
cd ~/monolith-to-microservices/react-app/src/pages/Home mv index.js.new index.js
-
Menampilkan isi file index.js
cat ~/monolith-to-microservices/react-app/src/pages/Home/index.js
-
Build ulang aplikasi
cd ~/monolith-to-microservices/react-app npm run build:monolith
-
Deploy ulang container dan ganti versi menjadi 2.0.0
cd ~/monolith-to-microservices/monolith gcloud builds submit --tag us-central1-docker.pkg.dev/${GOOGLE_CLOUD_PROJECT}/monolith-demo/monolith:2.0.0
- re-deploy
gcloud run deploy monolith --image us-central1-docker.pkg.dev/${GOOGLE_CLOUD_PROJECT}/monolith-demo/monolith:2.0.0 --region us-central1
- Untuk memverifikasi deployment
gcloud run services describe monolith --platform managed --region us-central1