forked from LS80/python-code-test
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver-setup.sh
More file actions
executable file
·23 lines (19 loc) · 1013 Bytes
/
server-setup.sh
File metadata and controls
executable file
·23 lines (19 loc) · 1013 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/bash
USER=ubuntu
echo -e "\033[0;34m > Provisioning Vagrant server, with the following parameters:\033[0m"
echo -e "\033[0;34m > Main User: $USER\033[0m"
# Housekeeping
echo -e "\033[0;34m > Installing system packages.\033[0m"
apt-get update
apt-get install -y git vim build-essential python3.5-dev python3-venv \
libncurses5-dev fabric postgresql-9.5 postgresql-server-dev-9.5 \
libjpeg62-dev zlib1g-dev libfreetype6-dev
# Postgres DB setup
echo -e "\033[0;34m > Setting up DB. If it already exists this will generate warnings, but no harm will be done.\033[0m"
sudo -u postgres psql -c "CREATE DATABASE codetest ENCODING='UTF8' TEMPLATE=template0;"
sudo -u postgres psql -c "CREATE USER ubuntu;"
sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE codetest TO ubuntu;"
sudo -u postgres psql -c "ALTER USER ubuntu CREATEDB;"
# do the rest as the user we'll be logging in as through SSH
chmod +x /vagrant/scripts/server-setup-user.sh
sudo -H -u $USER /vagrant/scripts/server-setup-user.sh