antarctica / monolith-service-deployment-client
Client for interacting with AWS Code Deploy for deploying Monolith services
Requires
- aws/aws-sdk-php: ^3.19
README
A simple client to upload and deploy application archives using AWS S3 and AWS Code Deploy using the AWS PHP SDK
This project uses version 0.3.0 of the Base flavour of the BAS Base Project - Pristine.
Overview
This package provides an opinionated client for deploying applications (services) developed for the Monolith shared hosting environment.
Specifically this package is purpose designed for the Monolith Service Deployment Image
Consequently, this package is not a general purpose AWS Code Deploy client or similar.
It provides two features:
- uploads application archives to AWS S3 as a Code Deploy revisions
- deploys such revisions using AWS Code Deploy to a number of instances
Usage
Because of how this package is designed to be used, all configurable parts of this package are configured using environment variables.
Environment Variable | Required | Default Value | Example value |
---|---|---|---|
AWS_ACCESS_KEY_ID | Yes | Not Set | xxx |
AWS_SECRET_ACCESS_KEY | Yes | Not Set | xxx |
AWS_DEFAULT_REGION | Yes | Not Set | eu-west-1 |
S3_BUCKET | Yes | Not Set | bas-packages-dev |
MONOLITH_REVISIONS_PATH | Yes | Not Set | zips/apps |
MONOLITH_SERVICE_NAME | Yes | Not Set | ExampleService |
MONOLITH_SERVICE_REVISION | Yes | Not Set | example |
DEPLOYMENT_CONFIG | Yes | Not Set | CodeDeployDefault.OneAtATime |
DEPLOYMENT_GROUP_NAME | Yes | Not Set | MonolithDevelopment |
See the Example Client for an example of using this package.
Developing
Setup
- Ensure you meet all the requirements to bring up a local development environment
- Checkout this project locally
$ git clone git@bitbucket.org:antarctica/monolith-service-deployment-client.git
$ cd monolith-service-deployment-client/provisioning/site-development-local
$ vagrant up
$ cd ..
$ ansible-playbook site-development-local.yml
Source control
Write access to this repository is restricted. Contact the project maintainer to request access.
Issues
Issues for this project are managed using Trello.
Tests
This project uses manual testing only.
$ cd provisioning/site-development-local
$ vagrant up
$ cd ..
$ ansible-playbook site-development-local.yml
$ cd site-development-local
$ vagrant ssh
$ cd /srv/apps/monolith-deployment-php-client
- set environment variables [1]
$ php example-client.php
[1]
$ export AWS_ACCESS_KEY_ID=xxx && export AWS_SECRET_ACCESS_KEY=xxx && export AWS_DEFAULT_REGION=eu-west-1 \
&& export S3_BUCKET=bas-packages-dev && export MONOLITH_REVISIONS_PATH=zips/apps \
&& export MONOLITH_SERVICE_NAME=ExampleService && export MONOLITH_SERVICE_REVISION=a35fa2c61a170112f46a319a118bf57e014cd3fe \
&& export DEPLOYMENT_CONFIG=CodeDeployDefault.OneAtATime && export DEPLOYMENT_GROUP_NAME=MonolithDevelopment
Feedback
The maintainer of this project is BAS Web & Apps Team, they can be contacted at: webapps@bas.ac.uk.
Licence
Copyright 2016 NERC BAS.
Unless stated otherwise, all documentation is licensed under the Open Government License - version 3. All code is licensed under the MIT license.
Copies of these licenses are included within this project.