apollo-deploy

Deployment tool

Usage no npm install needed!

<script type="module">
  import apolloDeploy from 'https://cdn.skypack.dev/apollo-deploy';
</script>

README

Apollo

Apollo Test Status Coverage Status

Apollo is a set of tools for rapid software deployment and continous integration. It has a client (Apollo), which is used for deploying via a git remote to various environments, and a server (Apollo CI) [To Be Built] which integrates into existing git platforms (atlassian, github) to run automated tests against created pull-requests.

Installation and Setup

[Warning] Apollo is still actively in development.

In the current version of Apollo, we assume that you have servers that are properly configured to communicate to a central repo, and can be SSHd into by the local machine via a private key file. In future versions of Apollo, we may release username/password authentication as a feature.

Grab Apollo From npm

npm install -g apollo-deploy

Will install Apollo and its dependencies.

Create A Deployment Config File.

View Apollo's documentation on configuration for an example of how to structure your config file. It doesn't matter where you put the file, or what you name it. We recommend, however, that you put your file in a repo that your team uses to synchronize (future versions of Apollo will auto-pull on deploy). For obvious reasons, keeping the deployment config synchronized among your team is important.

Setup Apollo

Next you'll want to run Apollo's setup command. This will step you through the process of telling Apollo about your dev environment, such as where to look for your deployment configuration.

apollo setup

That's it for installation! Now Apollo is on your machine and ready to deploy according to whatever your configuration outlines. View Apollo's documentation on commands and configuration for more details

Commands

apollo deploy [Project/Repo Name] [Environment Name] [branch="master"]

Runs Apollo's deploy process.

  • Deploys from master by default.
  • Creates a dated release branch.
  • Rolls back to previous release if deployment fails.
  • Alert appropriate channels (Slack, Email)
  • Select impact of deployment to be sent out to channels.
  • [Not Implemented] Keeps server configurations synced between devs. Warn and confirm deploy if not synced.
  • [Not Implemented] Runs custom scripts for pre-deploy and post-deploy operations.

apollo config set [propertyName] [value]

Modifies apollo's global runtime configuration, not the configuration file detailing server/project/repo information. The global configuration exists seperately so that private-key paths and proxy-url configurations can be set without touching a potentially git-tracked team configuration file.

Here are Apollo's respected global config values:

// global.json
{
    "deployConfig": "/some/path/apollo.conf", // Set by apollo setup command. No default value otherwise *MUST* be set before deploying.
    "stagingDirectory": "/tmp/staging", // Directory that clones, checkouts and pushes with be made from.
    "sshKey": "~/.ssh/id_rsa",		// The SSH private key for connecting to servers being deployed to
    "gitKey": "~/.ssh/id_rsa", 	 	// The key to use for *LOCAL* Git staging (clone/checkout/pull/push),
    "httpProxy": "",				// Proxy configurations use the default environment variables by default
    "httpsProxy": ""
}

apollo config get [propertyName=*]

Prints out the current state of config or config value.

apollo rollback [configuration name] [env] [Not Implemented]

  • Rollback of current release branch in environment to last release
  • Allow public key auth configuration. Should fall back to usersame/password.

apollo repositories add[Not Implemented]

  • Brings up prompt for adding a repository and it's associated environments

apollo add cleanup [amountRemaining][Not Implemented]

  • Delete apollo release branches until there are a maximum of [amountRemaining] available

When implemented this function will call something equivelent to the following two bash commands: git branch -a | pcregrep -o1 'remotes/origin/(release/.*)' | xargs git branch -d git branch -a | pcregrep -o1 'remotes/origin/(release/.*)' | xargs git push origin --delete

./apollo repositories get [repository]

  • Prints out the current state of repositories or single repository value.

./apollo environments [Not Implemented]

  • Output a list of all configured environments

./apollo help [Not Implemented]

  • Output a list of all the above commands

Configuration

Below is an example of a valid configuration file.

exampleConfig.json

{
    "repos": {
        "example-repo1": {
            "deployFrom": "ssh://git@git.bla.com/example-repo.git",
            "folderName": "awesome-repo",
            "deployables": {
                "dev": "event-dev",
                "prod": "event-prod"
            }
        },
        "example-repo2": {
            "deployFrom": "ssh://git@git.fake.com/example-repo.git",
            "folderName": "fail",
            "deployables": {
                "dev": "event-dev",
                "prod": "event-prod"
            }
        }
    },
    "projects": {
        "everything": {
            "repos": ["example-repo1", "example-repo2"],
            "deployables": {
                "dev": "event-dev",
                "prod": "event-prod"
            }
        }
    },
    "environments": {
        "event-dev": {
            "addresses": ["127.0.0.1"],
            "username": "apollo",
            "path": "/packages-dev/",
            "integrations": {
                "slack": [
                    {
                        "messageOn": ["start-deploy", "fail-deploy"],	
                        "webhook": "https://hooks.slack.com/services/000/000/000",
                        "channel": "#dev_channel"
                    }
                ]
            }			
        },
        "event-prod": {
            "addresses": ["127.0.0.1"],
            "username": "apollo",
            "path": "/packages-prod/",
            "integrations": {
                "slack": [
                    {
                        "messageOn": ["post-deploy"],	
                        "webhook": "https://hooks.slack.com/services/000/000/000",
                        "channel": "#support_channel"
                    }
                ]
            }
        }
    }
}