Skip to content

Commit

Permalink
Deploying docker image as quick demo on GCE (#25)
Browse files Browse the repository at this point in the history
* Added instructions to run Apigee kickstart with docker image on GCE
  • Loading branch information
giteshk authored Aug 16, 2023
1 parent 89d23d6 commit 310b146
Showing 1 changed file with 61 additions and 0 deletions.
61 changes: 61 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,67 @@ Navigate to `localhost:8080` and you will see an Apigee Portal installed with de

Default admin credentials for the portal are: `[email protected]` and `pass`, but you can change these in `apigee.env`.

## Demo Apigee Kickstart on Google Compute instance with docker image
1. Setup variables
```
export PROJECT_NAME=gcp-project-1
export ZONE=us-central1-a
export VM_NAME=apigee-portal-server
export FIREWALL_NAME=apigee-portal-server-fw
```
2. Create a GCE VM instance with `container-optimized-os` image and create a firewall rule to allow HTTP traffic to this VM.
```
gcloud compute instances create $VM_NAME \
--project=$PROJECT_NAME \
--zone=$ZONE \
--machine-type=e2-medium \
--network-interface=network-tier=PREMIUM,stack-type=IPV4_ONLY,subnet=default \
--no-restart-on-failure \
--maintenance-policy=TERMINATE \
--provisioning-model=SPOT \
--instance-termination-action=STOP \
--scopes=https://www.googleapis.com/auth/cloud-platform \
--tags=drupal-server,http-server \
--create-disk=auto-delete=yes,boot=yes,device-name=$VM_NAME,image=projects/cos-cloud/global/images/family/cos-stable,mode=rw,size=10,type=projects/$PROJECT_NAME/zones/$ZONE/diskTypes/pd-balanced \
--no-shielded-secure-boot \
--shielded-vtpm \
--shielded-integrity-monitoring \
--labels=goog-ec-src=vm_add-gcloud \
--reservation-affinity=any

gcloud compute --project=$PROJECT_NAME firewall-rules create $FIREWALL_NAME --direction=INGRESS \
--priority=1000 --network=default --action=ALLOW --rules=tcp:80 --source-ranges=0.0.0.0/0 \
--target-tags=drupal-server

```

3. SSH into the VM and run commands in next step
```
gcloud compute ssh $VM_NAME --zone=$ZONE --project=$PROJECT_NAME
```

4. Login into the GCE instance and run the following commands
```
wget https://gist.githubusercontent.com/giteshk/35875a36decd24c61a9d0fb5c6afad42/raw/6c0ec1d4dc1c0d16e42d971404509f53628ec4da/startup.sh
chmod +x startup.sh
bash ./startup.sh
```

5. Run through the Drupal installation wizard @ http://GCE-INSTANCE-EXTERNAL-IP
External IP can be located using :
```
gcloud compute instances describe $VM_NAME \
--format='get(networkInterfaces[0].accessConfigs[0].natIP)' \
--zone=$ZONE --project=$PROJECT_NAME
```

6. Clean up commands:
```
gcloud compute --project=$PROJECT_NAME firewall-rules delete $FIREWALL_NAME --quiet
gcloud compute instances delete $VM_NAME --project=$PROJECT_NAME --zone=$ZONE --quiet
```


## Disclaimer

This is not an official Google Product.

0 comments on commit 310b146

Please sign in to comment.