diff options
author | 2018-02-19 23:13:36 +0100 | |
---|---|---|
committer | 2018-02-19 22:13:36 +0000 | |
commit | d9317acf26babbc1aa31c234c83db138f9475596 (patch) | |
tree | 015bfb91bc69625851c90760aac28d70eb57c8d9 | |
parent | Readme (#23) (diff) |
Add Vagrantfile
* attempt to fix stacktrace when initialising logger
* adds vagrantfile for local development
* restart rethinkdb after setting config
* fix source .profile
* adds alias python=python3.6
* include more reminder of what to add in hosts file
* also install snekchek in vm
* update vagrant bootstrap script to properly include environment variables in bashrc
-rw-r--r-- | .gitignore | 3 | ||||
-rw-r--r-- | Vagrant_bootstrap.sh | 75 | ||||
-rw-r--r-- | Vagrantfile | 24 |
3 files changed, 102 insertions, 0 deletions
@@ -102,3 +102,6 @@ ENV/ # RethinkDB data rethinkdb_data/ + +# Vagrant +.vagrant/ diff --git a/Vagrant_bootstrap.sh b/Vagrant_bootstrap.sh new file mode 100644 index 00000000..32e779f5 --- /dev/null +++ b/Vagrant_bootstrap.sh @@ -0,0 +1,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)' diff --git a/Vagrantfile b/Vagrantfile new file mode 100644 index 00000000..deb6d019 --- /dev/null +++ b/Vagrantfile @@ -0,0 +1,24 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +VAGRANTFILE_API_VERSION = "2" + +Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| + + config.vm.define "pddev" do |dev| + dev.vm.box = "ubuntu/xenial64" + dev.vm.host_name = "pddev" + dev.vm.network :private_network, ip: "10.1.0.2" + config.vm.provider :virtualbox do |vb| + vb.customize ["modifyvm", :id, "--memory", "2048"] + vb.customize ["modifyvm", :id, "--ioapic", "on"] + vb.customize ["modifyvm", :id, "--cpus", "2"] + vb.linked_clone = true + config.vm.synced_folder ".", "/vagrant", + type: "virtualbox", + mount_options: ["dmode=775,fmode=775"] + end + config.vm.provision "shell", path: "Vagrant_bootstrap.sh" + end + +end |