This is an open-source project. It is not covered by Apigee support contracts. For help, please open an issue in this GitHub project. You are also always welcome to submit a pull request.
This is a sample project to show you how to setup Apigee Developer Portal Kickstart on Google Kubernetes Engine
The reason we used the GCP PHP docker base image is to take advantage of the updates GCP team provides and also to use integrations with other GCP tools
-
This repository is setup as a Template Repository to allow you to easily clone for multiple projects
-
Clone this repository and set it up on Cloud Source Repositories for your GCP project
-
Create a trigger using Cloud Build. Use the cloudbuild.yaml file provided with this project or make appropriate modifications for your project.
-
You may choose to set this up on Docker Hub make sure to set the Dockerfile location to
container-assets/Dockerfile
and the Build Context to/
-
Setup the Database
- Create a Cloud SQL instance (MySQL)
- Create a database with the name
apigee_devportal
- Create a User e.g.
portal_dbuser
and set a password - Make sure that to assign a private IP to this instance and removing public access
- You can choose to run the following gcloud commands instead of configuring from the UI
MYSQL_INSTANCE_NAME=apigee-devportal-instance COMPUTE_REGION=us-east1 COMPUTE_ZONE=us-east1-c DRUPAL_DB_NAME=apigee_devportal DRUPAL_DB_USER=portal_dbuser DRUPAL_DB_PASS=portal_dbpassword gcloud beta sql instances create $MYSQL_INSTANCE_NAME \ --tier=db-n1-standard-2 --region=$COMPUTE_REGION --network=default --no-assign-ip gcloud sql databases create $DRUPAL_DB_NAME --instance=$MYSQL_INSTANCE_NAME gcloud sql users create $DRUPAL_DB_USER \ --host=% --instance=$MYSQL_INSTANCE_NAME --password=$DRUPAL_DB_PASS
-
Drupal needs a file system to store the uploaded content and the generated assets. To allow GKE to spin multiple replicas of the container we are going to setup a Filestore Instance.
You may choose to use the following gcloud command
gcloud filestore instances create apigee-devportal-files-instance \ --zone=$COMPUTE_ZONE --file-share=capacity=1TB,name=portal_files --network=name=default
-
Create a Kubernetes cluster or you may choose to deploy this application to an existing cluster
-
Copy the kubernetes/dev.example.com and set one up for your project e.g. developer.acme.com
cp -rf kubernetes/dev.example.com kubernetes/developer.acme.com
-
Modify the kubernetes/developer.acme.com/kustomization.yaml file to add in the Database server details and credentials.
- database-host=127.0.0.1 - database-port=3306 - database-name=devportal - dbusername=dbuser - dbpassword=dbp@ssw0rd
Update the image URL to build from your project. Insert your GCP Project Name.
newName: gcr.io/<GCP-PROJECT-NAME>/apigee-devportal
-
Modify the kubernetes/developer.acme.com/filestore-patch.yaml to add in your filestore details Modify the path if you modified the above command. Add in the IP address of the Filestore instance
server: <Filestore_ip> path: /portal_files
-
Create the deployment using the following command
kubectl apply -k kubernetes/developer.acme.com/
-
Get the IP Address of the apigee-portal-ingress from the Services. Use that to start the drupal install process from the browser.
You will need docker-compose to run this setup locally. Installation instructions here
Please note Docker on Mac could be slow.
-
To setup the local project run
./setup-project.sh
- This will run "composer install" and setup the
code
directory and the drupal-files directory locally. - You may choose to check in your entire
code
directory to the repository. This will ensure that your container image is built with the version in source control. - code/sites/default/files and drupal-files directory should not be added to source control. Since these are typically files that user uploads. You can choose to copy them over to your local files to Filestore instance after finishing development
- code/sites/default/files content should be copied over the the filestore_instance/public
- drupal-files/private content should be copied over to filestore_instance/private
- drupal-files/config content should be copied over to filestore_instance/config
- This will run "composer install" and setup the
-
To start the project run
docker-compose up
. Once the services are up you can navigate to http://localhost:5000 -
You can run through the install from the browser.
-
To stop the project run
docker-compose down
. -
To delete the database you can delete the volume that is created or run
docker-compose down -v
. This will let you run through a fresh install. You may need to delete the files in drupal-files/private , drupal-files/private, code/web/sites/default/files directory -
To update the dependencies you can run
./update-project.sh
and then commit all the updates in thecode
directory to source control. -
To ssh into the Drupal container use
docker-compose exec apigee-kickstart /bin/bash
- You can run drush commands or composer install commands from the /app/code directory
- code and the drupal-files directories are mounted to /app/code or /app/drupal-files directories on the container. So any changes you make will be automatically reflected in that directory.
-
To get access to the database you can run
docker-compose exec apigee-kickstart drush sqlc
docker-compose down -v