Skip to content

Instantly share code, notes, and snippets.

@fdemmer
Forked from ashwoods/default.conf
Last active April 26, 2017 14:25
Show Gist options
  • Save fdemmer/b2f5155c86f242b969a64b26ae79679b to your computer and use it in GitHub Desktop.
Save fdemmer/b2f5155c86f242b969a64b26ae79679b to your computer and use it in GitHub Desktop.
server {
listen *:80 default;
server_name _;
location / {
client_max_body_size 1G;
proxy_pass http://127.0.0.1:8000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
location /assets {
alias /vagrant/assets;
}
}
#!/usr/bin/env bash
set -e
# install system dependencies
sudo apt-get update && sudo apt-get install -y --no-install-recommends \
tcl \
tk \
wget \
git \
mercurial \
build-essential \
libssl-dev \
zlib1g-dev \
libbz2-dev \
libreadline-dev \
libsqlite3-dev \
llvm \
libncurses5-dev \
libncursesw5-dev \
libffi-dev \
libssl-dev \
xz-utils \
libxml2-dev \
libxslt1-dev \
libtiff5-dev \
libjpeg62-turbo-dev \
libfreetype6-dev \
liblcms2-dev \
libwebp-dev \
tcl8.6-dev \
tk8.6-dev \
python-tk \
libpq-dev \
nginx \
vim \
gettext \
tmux \
libcairo2-dev \
postgresql-client \
libpango1.0-dev \
# configure nginx
sudo curl -s -S -L https://gist.githubusercontent.com/ashwoods/d6d671a08a904fdffc9f0aa56d4d4f34/raw/default.conf -o /etc/nginx/sites-enabled/default
sudo /etc/init.d/nginx restart
# copy default .env file if it doesn't exist
if [ ! -f /vagrant/.env ]; then
cp /vagrant/.env.example /vagrant/.env
fi
# create a ssh key
if [ ! -f /home/vagrant/.ssh/id_ed25519 ]; then
ssh-keygen -t ed25519 -f ~vagrant/.ssh/id_ed25519 -N ""
fi
# configure pyenv
touch /home/vagrant/.bash_profile
grep -q -F "export PATH=\"/home/vagrant/.pyenv/bin:\$PATH\"" ~/.bash_profile || echo "export PATH=\"/home/vagrant/.pyenv/bin:\$PATH\"" >> ~/.bash_profile
grep -q -F "eval \"\$(pyenv init -)\"" ~/.bash_profile || echo "eval \"\$(pyenv init -)\"" >> ~/.bash_profile
grep -q -F "eval \"\$(pyenv virtualenv-init -)\"" ~/.bash_profile || echo "eval \"\$(pyenv virtualenv-init -)\"" >> ~/.bash_profile
grep -q -F "cd /vagrant" ~/.bash_profile || echo "cd /vagrant" >> ~/.bash_profile
curl -s -S -L https://raw.githubusercontent.com/yyuu/pyenv-installer/master/bin/pyenv-installer | bash
source /home/vagrant/.bash_profile
# export PATH="/home/vagrant/.pyenv/bin:$PATH"
# eval "$(pyenv init -)"
# eval "$(pyenv virtualenv-init -)"
# install requirements in default pyenv environments defined in .python-version
while IFS='' read -r line || [[ -n "$line" ]]; do
pyenv install -s $line || true
export PYENV_VERSION=$line
pip -q install --upgrade pip wheel setuptools
pip --version
pip -q install --upgrade cffi
pip -q install -r /vagrant/requirements/local.txt
pip -q install -e /vagrant/
pyenv global $line
done < "/vagrant/.python-version"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment