Get started

1. Install Salt

On macOS, using Homebrew, install Salt and Salt SSH with:

brew install salt

If you encounter issues, try installing with pip:

pip install salt salt-ssh

For other operating systems and package managers, see this page (or this page) to install a recent version (2019 or later).

You must use Salt with Python 3. If your system package uses Python 2, install salt-ssh with pip into a Python 3 virtual environment.

2. Clone repositories

You must first have access to two private repositories. Contact an owner of the open-contracting organization on GitHub for access. Then:

git clone git@github.com:open-contracting/deploy.git
git clone git@github.com:open-contracting/deploy-salt-private.git deploy/salt/private
git clone git@github.com:open-contracting/deploy-pillar-private.git deploy/pillar/private

Note: This documentation is for working with OCP servers. If you want to work with other servers, then instead of cloning the private repositories, copy and edit the template directories:

git clone git@github.com:open-contracting/deploy.git
cp -r deploy/pillar/private-templates deploy/pillar/private
cp -r deploy/salt/private-templates deploy/salt/private

3. Add public key to remote servers

Add your public key to salt/private/authorized_keys/root_to_add, e.g.:

cat ~/.ssh/id_rsa.pub >> salt/private/authorized_keys/root_to_add
git commit salt/private/authorized_keys/root_to_add -m "Add public key"
git push origin master

Then, add this public key to all servers:

salt-ssh -i '*' state.sls_id root_authorized_keys_add core

4. Configure Salt for non-root user

Unless your local user is the root user, run:

./script/setup

This script assumes your SSH keys are ~/.ssh/id_rsa and ~/.ssh/id_rsa.pub.

You’re now ready to Deploy an app.