Skip to content
This repository has been archived by the owner on Oct 1, 2020. It is now read-only.

Commit

Permalink
add scripts for one-click deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
monty5811 committed Apr 29, 2016
1 parent fc4aa54 commit 02c1824
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 7 deletions.
14 changes: 7 additions & 7 deletions ansible/env_vars/example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
# Let's Encrypt (free SSL):
le_email: ""
# Database settings
db_password:
db_password: "this should be changed to a long random string"
# Nginx settings
nginx_server_name:
nginx_server_name: "server_name_replace_me"
# Application Settings
django_secret_key: 'this should be a very long string'
# this is used in the account related emails and should match your server settings
account_default_http_protocol: 'https'
# Twilio Credentials
twilio_account_sid:
twilio_auth_token:
twilio_from_num:
twilio_sending_cost:
twilio_account_sid: 'replace me'
twilio_auth_token: 'replace me'
twilio_from_num: 'replace me'
twilio_sending_cost: '0.04' # replace me
# Whitelisted domains
whitelisted_login_domains:
# Email
Expand All @@ -22,7 +22,7 @@ django_email_host_user:
django_email_host_password:
django_from_email:
# locale and time zone:
django_time_zone:
django_time_zone: 'Europe/London' # change me
# Elvanto
elvanto_key:
country_code:
Expand Down
14 changes: 14 additions & 0 deletions app.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: apostello
image: ubuntu-14-04-x64
min_size: 512mb
config:
#cloud-config
users:
- name: apostello
groups: sudo
shell: /bin/bash
sudo: ['ALL=(ALL) NOPASSWD:ALL']
packages:
- curl
runcmd:
- cd /home/apostello && curl -sf https://raw.githubusercontent.com/monty5811/apostello/master/scripts/install.sh | sh
56 changes: 56 additions & 0 deletions scripts/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
set -e
AP_VER=v1.6.0

echo "Installing and upgrading packages"
sudo apt-get update -qq
sudo apt-get upgrade -y
sudo apt-get install -y \
git \
libffi-dev libssl-dev openssl \
python-virtualenv python-dev

echo "Setting up ansible environment"
if [ ! -d 'apostello-install' ]; then
echo "First run, cloning apostello..."
git clone https://github.com/monty5811/apostello.git apostello-install
cd apostello-install
git checkout $VERSION
echo "Setting up virtualenv"
virtualenv venv --no-site-packages
./venv/bin/pip install -U pip
./venv/bin/pip install -U setuptools
./venv/bin/pip install ansible
else
cd apostello-install
echo "Updating apostello..."
git fetch
git checkout $AP_VER
fi

cd ansible
echo "Detecting IP and writing to config"
IP=`ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1'`
sed -i -e "s/server_name_replace_me/$IP/g" env_vars/example.yml

echo "Running ansible deploy"
./../venv/bin/ansible-playbook -i 127.0.0.1, production.yml --connection=local

echo "################################################################"
echo "## apostello is now running on this server ##"
echo "## ##"
echo "## If this is your first time setup, you need edit ##"
echo "## apostello-install/ansible/env_vars/example.yml ##"
echo "## ##"
echo "## You must set up your email settings, or apostello will not ##"
echo "## function correctly! ##"
echo "## ##"
echo "## Email setup: http://goo.gl/nkjPdy ##"
echo "## Twilio setup: http://goo.gl/2lt8dX ##"
echo "## ##"
echo "## Then run the command: ##"
echo "## ./apostello-install/scripts/install.sh ##"
echo "## ##"
echo "## Future upgrades can be carried out by running the same ##"
echo "## command ##"
echo "## ##"
echo "################################################################"

0 comments on commit 02c1824

Please sign in to comment.