Forge - commotioncreativeltd/octobercms-deployment GitHub Wiki
Add client credentials and create new server
You can manage multiple provider accounts in Forge which is great. I add all my client accounts so I can launch a fully configured EC2 instance then firm up the security in a later step.
- Log into Forge
- Go to My Account > Server Providers
- Select Amazon and enter your Client Name and the Key and Secret obtained earlier from the forge IAM user from AWS
- Once happy click Save
- Head on back to the main dashboard and spin up a new server, making sure to select your newly created client from the dropdown list
- Below are the naming conventions and settings I use for a new server (in most case I utilise AWS free tier)
- Name: commotion-creative (client name in a slugable format)
- Server Size: 1 GiB RAM - 1 vCPU - $0.013 / Hour - $10 / Month
- Region: Ireland
- Database Name (Optional): commotioncreative (client name all lower case and no spaces)
- ( ) Provision As Load Balancer
- ( ) Install HHVM & Hack
- ( - ) Install MariaDB 10.1
- Once happy click Create Server
This process can sometimes take 30 minutes (usually about 10) so start playing Clash of Clans! Once complete Forge will email you you're server details. Be sure to make a note of the following:
- Username
- Sudo Password
- Database Username
- Database Password
Once the details are securely saved I like to delete the email.
Update Forge server meta information
With the newly associated Elastic IP we need to tell Forge about this change:
- Go to the Forge dashboard and select the client server from the list (click the pencil icon)
- go to the Meta tab, update the IP address to the newly created Elastic IP and click Update Metadata
- Head back to the Forge Dashboard and click the refresh button on the new client server
- This should return Successful, if not start to panic!
Setup SSH keys to the server
- Forge Dashboard > Edit client server > SSH Keys
- Enter a name i.e commotion-mat-macbook
- copy your public SSH key. An easy way to get this I find is to open the file in something like Sublime. Example command: sublime ~/.ssh/id_rsa.pub
- click Add Key
Setup new domain
- Forge Dashboard > Edit client server > Sites
- delete the default site
- add a new domain with the following details
- Root Domain: clientname.hostcommotion.net
- Directory (Optional): public
- ( ) Allow Wildcard Sub-Domains
- click Add Site
This will take a second or two to install so with this time be sure to setup the DNS A record to point to the above IP and domain
Deploy Website
- Forge Dashboard > Edit client server > Sites > Edit Domain > Apps
- enter the Git repo details
- ( - ) Install Composer Dependencies
- click Install Repository
This can take a few minutes so take a break or get a drink.
I've found this process to fail on a few occasions. The main one is that the server deployed hasn't enough memory to complete the installation of all composer dependancies the project requires. If this happens you can stop the server ngix and mysql services, deploy again and turn the services back on. This has worked every time for me so if it doesn't for you, I'm not sure sorry :-/
- Once deployed we need to modify the deploy script
cd /home/forge/webfolder
git pull origin master
composer install --no-interaction --no-dev --prefer-dist
php artisan october:up
php artisan october:mirror public/
I sometimes add in private repos here too so for example:
cd /home/forge/webfolder
git pull origin master
composer install --no-interaction --no-dev --prefer-dist
php artisan october:up
# private repo plugin
cd plugins/namespace/pluginname
git pull origin master
composer install --no-interaction --no-dev --prefer-dist
cd ../../../
php artisan october:mirror public/
WARNING : This is current untested code so please exercise caution, however the logic works in my head and I've run a manually version of this process locally a few times. Will update when I test more.
NOTE : This also presumes you've already manually run a git clone repotoclone.git plugins/namespace/pluginame
command.
- Save Deploy Script and Enable Quick Deploy
- Now click the Environment tab and enter your environment details. I copy these from my local development file and modify where needed i.e. database settings