Last active
July 13, 2016 10:57
-
-
Save pburkholder/bee382bb366346ae5a5cba7286e68e11 to your computer and use it in GitHub Desktop.
test-kitchen files for deploying GovReady-Q
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
driver: | |
name: vagrant | |
network: | |
- ["forwarded_port", {guest: 8000, host: 8080}] | |
provisioner: | |
name: shell | |
log_level: debug | |
platforms: | |
- name: ubuntu-14.04 | |
suites: | |
- name: default |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Script for deploying to Vagrant with test kitchen | |
# The repository is private in GitHub, so you'll need | |
# to configure a "deploy key" for the repository, and | |
# provide that to the instance. | |
# | |
# Then, `kitchen converge` should bring up an instance with Q | |
# running and listening on localhost:8080 | |
# | |
set -x | |
do_sudo_stuff() { | |
# Update the cache of available packages | |
apt-get update | |
# Uncomment the next line if you actually need to upgrade packages | |
#[ $? == 0 ] && apt-get upgrade -y | |
apt-get install -y git python3-pip unzip | |
pip3 install -U pip # get pip8 or so to work with git+https | |
} | |
vagrant=/tmp/vagrant$RANDOM | |
echo SENDING TO $vagrant | |
cat<<ENDV>$vagrant | |
#!/bin/bash -x | |
cd /home/vagrant | |
mkdir -p .ssh | |
chmod 0700 .ssh | |
cat <<ENDCONF>.ssh/config | |
Host github.com | |
IdentityFile /home/vagrant/.ssh/govreadydeploykey | |
StrictHostKeyChecking No | |
ENDCONF | |
cat<<ENDKEY>.ssh/govreadydeploykey | |
-----BEGIN RSA PRIVATE KEY----- | |
MIIJKAIBAAKCAgEAz2NCBu1i3ERUWOIjYeWOZkq6HgdvKsAMKaBwZ9Y5ZAqTQCag | |
Xn0SHP6XYDsQDLhTbQH2VKfjP7X8Z+YcCE3OWu1ezbq5KfIYJD6TPdgxKp7dnGxp | |
... snip ... no longer a real key | |
4D/D+SqVb2lQN4gONgQXQlF7jACE07kTAyr4Zz3DChWE6tws52KcHyPKv14= | |
-----END RSA PRIVATE KEY----- | |
ENDKEY | |
# use deploykey to get the private repository | |
chmod 0400 /home/vagrant/.ssh/govreadydeploykey | |
git clone git@github.com:pburkholder/govready-q.git | |
cd govready-q | |
pip install --user -r requirements.txt | |
deployment/fetch-vendor-resources.sh | |
cat <<ENDJ>/home/vagrant/govready-q/local/environment.json | |
{ | |
"debug": true, | |
"host": "localhost:8000", | |
"https": false, | |
"secret-key": "@-uks6_6r$e6qp2*7irerq5%l2a8vbtxv#fd4nfjyd%(fz85x4", | |
"govready_cms_api_auth": null | |
} | |
ENDJ | |
python3 manage.py migrate | |
python3 manage.py load_modules | |
python3 manage.py runserver | |
ENDV | |
do_sudo_stuff | |
chmod 755 $vagrant | |
/usr/bin/sudo -u vagrant $vagrant |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment