aboutsummaryrefslogtreecommitdiffstats
path: root/Vagrant_bootstrap.sh
blob: 32e779f5f85f7f7a0cfb472a29804c0ac0939c0b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/bin/bash

# Dependencies
apt-get update
apt-get install -y software-properties-common
apt-get install -y python-software-properties
apt-get install -y curl
apt-get install -y apt-transport-https
add-apt-repository -y ppa:jonathonf/python-3.6
echo "deb http://download.rethinkdb.com/apt xenial main" | sudo tee /etc/apt/sources.list.d/rethinkdb.list
wget -qO- https://download.rethinkdb.com/apt/pubkey.gpg | sudo apt-key add -
apt-get update

# Python3.6
apt-get install -y python3.6
apt-get install -y python3.6-dev
apt-get install -y build-essential
curl -s https://bootstrap.pypa.io/get-pip.py | python3.6 -
python3.6 -m pip install -r /vagrant/requirements.txt
python3.6 -m pip install -r /vagrant/requirements-ci.txt
python3.6 -m pip install gunicorn

# RethinkDB
apt-get install -y rethinkdb

tee /etc/rethinkdb/instances.d/rethinkdb.conf <<EOF
runuser=root
rungroup=root
bind=0.0.0.0
driver-port=28016
http-port=28010
EOF

service rethinkdb restart

# development environment variables
tee /root/.bashrc <<EOF
HISTCONTROL=ignoreboth
shopt -s histappend
HISTSIZE=1000
HISTFILESIZE=2000
shopt -s checkwinsize

if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
    debian_chroot=$(cat /etc/debian_chroot)
fi

case "$TERM" in
    xterm-color|*-256color) color_prompt=yes;;
esac

PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '

test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
alias ll='ls -alF --color=auto'
alias la='ls -A --color=auto'
alias l='ls -CF --color=auto'

export LOG_LEVEL=DEBUG
export SERVER_NAME="pysite.local"
export WEBPAGE_PORT="80"
export WEBPAGE_SECRET_KEY="123456789abcdefghijklmn"
export RETHINKDB_HOST="127.0.0.1"
export RETHINKDB_PORT="28016"
export RETHINKDB_DATABASE="database"
export RETHINKDB_TABLE="table"
export BOT_API_KEY="abcdefghijklmnopqrstuvwxyz"
alias python=python3.6
EOF

echo 'docs: https://github.com/discord-python/site/wiki/Development-Environment-(Vagrant)'