Skip to content
Schuyler Erle edited this page Jun 20, 2019 · 7 revisions

Staging server setup

These instructions more or less encompass setting up from scratch a server for staging deployments from the unstable buendia apt suite.

Create an SSH key pair

Don't set a passphrase on the private key.

ssh-keygen -t ecdsa -b 256 -C "CircleCI deployment" -f buendia-deploy
tar cvf buendia_deploy_keys.tar buendia-deploy*
gpg -c buendia_deploy_keys.tar
git add buendia_deploy_keys.tar.gpg
git commit
rm buendia_deploy_keys.tar

Add the SSH private key to CircleCI

Go to the SSH permissions configuration for this project in CircleCI and add the key there. Then update the deploy-staging job in .circleci/config.yml with the key fingerprint.

Create a new droplet in Digital Ocean

First, we set up a droplet in Digital Ocean running Debian 9.7. Add a new SSH key and upload the public key in buendia-staging.

Set the hostname to staging.buendia.org or similar and then set the STAGING_HOST variable in the CircleCI environment setup to same.

Create a buendia user and give it sudo access

Then, log into the staging host as root and run the following:

adduser buendia
echo "buendia ALL=(ALL:ALL) NOPASSWD:ALL" > /etc/sudoers.d/10-buendia-user
cp -a .ssh ~buendia
chown -R buendia:buendia ~buendia

Install buendia-server

apt-get update
apt-get install -y apt-transport-https
# Use buendia-github.list because buendia.list is overwritten by the buendia-* packages
echo "deb [trusted=yes] https://projectbuendia.github.io/builds/packages unstable main java" \
    >/etc/apt/sources.list.d/buendia-github.list
apt-get update
apt-get upgrade
apt-get install -y buendia-server buendia-site-test

This host should now be ready for deployment from the deploy-staging CircleCI job.

Clean up locally

Back in your own working directory, clean up the unencrypted SSH keys.

rm -f buendia-staging buendia-staging.pub

Clone this wiki locally