Code Monkey home page Code Monkey logo

apollo-build-script's Introduction

NDI Logo

  1. Introduction
  2. Components
  3. Required Setup
  4. Usage
  5. Authors

Introduction

This is a bash build script for rebuilding an Apollo instance, designed for use with CodeDeploy to deploy an updated version of the Apollo application. Given this intended use-case the script is not designed for deploying a fresh copy of Apollo, which requires a number of simple one-time installation and setup steps that it would be inefficient to repeatedly run for every update. Note that the script requires a certain installation standard, such as a specific file path that the application is installed at; however, the script can be easily modified for different configurations as needed. The script has two components: the .yml config file, appspec.yml, and the two bash script files, prebuild.sh and buildapollo.sh.

Components

appspec.yml

The appspec.yml file is a short configuration file that provides the information specifying the OS it will be deployed on, where to deploy the code, and which scripts to run in what order. Note that CodeDeploy will only work successfully if it is located in the top most directory. See below in the Usage section for more details on the deployment.

prebuild.sh and buildapollo.sh

The prebuild.sh and buildapollo.sh files are the two scripts for deploying Apollo. The prebuild.sh file runs before deployment, stopping the application and then copying the settings.ini file up a directory so that it is not overwritten on deployment. The buildapollo.sh file copies back the settings file and deploys the application. In order to completely ensure that the docker containers are rebuilt from the new version of the code and not from the existing images, the script removes all existing docker images. All application data in the database is kept in Docker volumes which are not touched, so no data is lost and the application will redeploy with all of the same data it had previously.

Required Setup

As mentioned above, for these scripts to work there should already be an instance of Apollo on the server. By default the appspec.yml file requires the server to be running linux as the OS, though this can be modified. The Apollo application should be installed in /home/ubuntu/apollo. The server should be running the aws codedeploy agent and have a IAM role assigned to it that has S3 read privileges. The server should also have CodeDeploy application's deployment group tag applied to it. The server must also be running at the time of the deployment in order for the deployment to succeed, as otherwise the deployment will fail and no changes will occur.

Usage

These scripts are intended for use with CodeDeploy as part of a CodePipeline instance. The first step of the pipeline should be a Source stage that pulls code both from this repository and the Apollo repository. The next stage should be a CodeBuild stage that takes the code from this repository and moves it into the directory of the code from the Apollo repository, and then deletes the empty directory leaving all of the code in one single directory. As mentioned above, the CodeDeploy stage will only succeed if the appspec.yml file is located at the top most level, so the CodeBuild stage should pull the contents of this directory and pass them along to the final stage of the pipeline, CodeDeploy, which will then deploy the code to a server. If all parts of the required setup are complete, the Apollo site should go down for approximately 3-5 minutes and then reappear with the updated code

Authors

  • Ben Lynch

apollo-build-script's People

Contributors

blynchndi avatar bwlynch avatar

Watchers

 avatar  avatar  avatar

Forkers

bwlynch

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.