Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploying docker image as quick demo on GCE #25

Merged
merged 2 commits into from
Aug 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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: `admin@example.com` 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.
Loading