Skip to content

Instantly share code, notes, and snippets.

@jodigiordano
Created February 22, 2016 00:58
Show Gist options
  • Save jodigiordano/11decb22171795379d09 to your computer and use it in GitHub Desktop.
Save jodigiordano/11decb22171795379d09 to your computer and use it in GitHub Desktop.
Vagrantfile pour e-petitions
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure('2') do |config|
config.vm.provider 'virtualbox' do |v|
v.memory = 4096
v.cpus = 4
end
config.vm.box = 'debian/jessie64'
config.vm.provision :shell, inline: <<-SCRIPT
apt-get update -y
apt-get install -y postgresql
su postgres << EOF
whoami
if ! psql epets_development -c '' 2>&1; then
psql -c "CREATE ROLE epets WITH CREATEDB LOGIN PASSWORD 'epets';"
createdb epets_development
createdb epets_test
psql -c "
GRANT all privileges ON database epets_development TO epets;
ALTER DATABASE epets_development OWNER TO epets;
GRANT all privileges ON database epets_test TO epets;
ALTER DATABASE epets_test OWNER TO epets;
"
fi
EOF
if ! grep -q "listen_addresses = '\*'" /etc/postgresql/9.3/main/postgresql.conf; then
echo listen_addresses = \'*\' >> /etc/postgresql/9.3/main/postgresql.conf
fi
if ! grep -q "^host all all 0\.0\.0\.0/0 md5$" /etc/postgresql/9.3/main/pg_hba.conf; then
echo host all all 0.0.0.0/0 md5 >> /etc/postgresql/9.3/main/pg_hba.conf
fi
if [ ! -f /home/vagrant/.pgpass ]; then
touch /home/vagrant/.pgpass
echo "localhost:5432:epets_development:epets:epets" >> /home/vagrant/.pgpass
echo "localhost:5432:epets_test:epets:epets" >> /home/vagrant/.pgpass
chmod 600 /home/vagrant/.pgpass
fi
service postgresql restart
SCRIPT
config.vm.network :forwarded_port, guest: 5432, host: 15432
end
@jodigiordano
Copy link
Author

Contenu de .env.development:

DATABASE_URL=postgres://epets:epets@127.0.0.1:15432/epets_development
SECRET_KEY_BASE=FA11FA11FA11FA11FA11
EPETITIONS_HOST=localhost
EPETITIONS_PORT=3000
EPETITIONS_PROTOCOL=http
MODERATE_HOST=localhost
SITE_TITLE="Petition parliament (Development)"
MEMCACHE_SERVERS=localhost:11211

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment