A Case Study by Cloud Office and Web Motion
Setting up the Google Cloud Platform Infrastructure
Provided by Cloud Office Sr. Cloud Architect in Google Cloud Platform
At Cloud Office we were assigned a medium-sized infrastructure project based on OctoberCMS (Laravel) and when it was time for deployment we were working together with the Development team at Web Motion.
Setting up the infrastructure took no more than a couple of hours. The customer wanted a severless solution. First we went through the App Engine Standard environment, but that proved to be less effective due to the specifics of OctoberCMS (Laravel).
Initial idea was to have the app scale down to 0, but that was a challenge, as having 0 instances to manage when there is no traffic is not possible. We then decided to switch to App Engine Flexible, so that there can always be one instance running for additional customizations through SSH.
With a couple of changes to the app.yaml file as well as the configurations listed later in this document and the linked article, the new environment for the deployment was up and running in the App Engine Flexible environment.
You can find a list of all of the steps that were made for the infrastructure creation in Google Cloud Platform below:
- Project creation
- Billing setup
- User additions and permissions
- Firewall rules
- SQL Instance creation
- SQL User creation
- Database creation
- Connection management
- Migration from test environment
- Storage bucket creation
- User access and permissions
- Migration from test environment
- Service accounts for component interactions
- Repository cloning to Cloud Shell
- Initial deployment for automatic App Engine Infrastructure
- Debugging and refactoring
- Double-checking for service account access and permissions
- Testing connections to components
- Deployment and debugging
- Cloud DNS domain management
- End-user access
- Admin access
Setting up the project
During our tests with Google App Engine Standard Environment, we found that it is not possible to set up OctoberCMS, because it has specific feature requirements, such as access to the console. We managed to start the project on Google App Engine Standard Environment, but some of the code snippets on the documentation’s example for Laravel on the Standard Environment were insufficient and we could not produce a completed deployment. We ended up setting up an App Engine Flexible Environment, which allows more configuration through a Dockerfile.
Preparing the app.yaml file
Create a file named app.yaml in the project root to set up the App Engine as a flexible environment. The variables in section “env_variables” are for configuring Laravel and OctoberCMS and will be explained in the linked article.
Our file is shown as an example below:
– name: ramdisk1
After the infrastructure and app.yaml were deployed, we then continued with setting up October CMS (Laravel) and the actual development.
Editing capabilities of OctoberCMS
Since data can be stored on the Docker instance only in the “/tmp” folder and PHP does not have the right to modify the code of the application in the /app folder (also if the code is modified, the changes are lost during the next deployment) we noticed that the result of this limitation was that editing pages in OctoberCMS is not possible within App Engine. Our solution is to locally edit the pages or using a staging server, then committing them to the code repo and deploying them on Google Cloud Platform.
Mounting the storage bucket
We used a Google Cloud Storage bucket. The storage bucket can be mounted with FUSE, unfortunately we could not find a way to mount the storage bucket in the Docker container, because the container did not have sufficient permissions. We had to use the less elegant solution of accessing the files through the “gs://” protocol, which required changes in the application, which you can find in the linked article.
|For any questions regarding your plans and infrastructure for your upcoming projects and/or deployments, don’t hesitate to reach out to [email protected] or use our contact form in the upper-right corner.|