...
 
Commits (3)
......@@ -4,14 +4,24 @@
Vagrant.configure(2) do |config|
config.vm.box = "debian/stretch64"
config.vm.network "forwarded_port", guest: 80, host: 8080
config.vm.network :forwarded_port, guest: 80, host: 8080
config.vm.provider "virtualbox" do |vb|
vb.memory = "4096"
end
config.vm.provision "shell", path: "vagrant/provision.sh"
config.vm.provision :shell, path: "vagrant/provision.sh", args: "'vagrant'"
# Forward agent when doing 'vagrant ssh' (needed for tunnels to ullmann/alioth)
config.ssh.forward_agent = true
config.vm.post_up_message = <<~HEREDOC
UDD set up at http://localhost:8080/
The database is, by default, empty. Either:
- use a tunnel to the real UDD: vagrant ssh -c /vagrant/vagrant/setup-tunnel.sh
this requires shell access to udd.debian.org and to enable SSH agent forwarding
- import (parts of) the real UDD:
vagrant ssh -c '/vagrant/vagrant/populate-db.sh all'
HEREDOC
end
#!/bin/sh
if [ ${#@} == 0 ]; then
echo "Usage: $0 <apache-user>"
echo "* apache-user: <user that will run Apache (it should be the provider, 'vagrant' or 'docker')>"
fi
set -x
set -e
sudo sed -i s/httpredir.debian.org/deb.debian.org/ /etc/apt/sources.list
......@@ -21,7 +27,7 @@ sudo service postgresql restart
sudo -u postgres dropuser udd || true
sudo -u postgres createuser -DRS udd
sudo -u postgres dropuser vagrant || true
sudo -u postgres createuser -DRS vagrant
sudo -u postgres createuser -DRS $1
sudo -u postgres dropdb udd || true
sudo -u postgres createdb -T template0 -E SQL_ASCII udd
# create the database, named 'udd', forcing the encoding to SQL_ASCII, since that's the format of the export.
......@@ -42,19 +48,9 @@ sudo ln -sf /etc/apache2/mods-available/cgi.load /etc/apache2/mods-enabled/
sudo ln -sf /etc/apache2/mods-available/rewrite.load /etc/apache2/mods-enabled/
sudo rm -f /etc/apache2/conf-enabled/serve-cgi-bin.conf
#
# Run apache2 as the vagrant user. Yes, eek. But this avoids all permission problems.
sudo sed -i 's/APACHE_RUN_USER=www-data/APACHE_RUN_USER=vagrant/' /etc/apache2/envvars
sudo sed -i 's/APACHE_RUN_GROUP=www-data/APACHE_RUN_GROUP=vagrant/' /etc/apache2/envvars
sudo chown -R vagrant:vagrant /var/log/apache2
sudo chown -R vagrant:vagrant /var/lock/apache2
# Run apache2 as the provider user. Yes, eek. But this avoids all permission problems.
sudo sed -i 's/APACHE_RUN_USER=www-data/APACHE_RUN_USER=$1/' /etc/apache2/envvars
sudo sed -i 's/APACHE_RUN_GROUP=www-data/APACHE_RUN_GROUP=$1/' /etc/apache2/envvars
sudo chown -R $1:$1 /var/log/apache2
sudo chown -R $1:$1 /var/lock/apache2
sudo service apache2 restart
echo "
UDD set up at http://localhost:8080/
The database is empty. Either:
- use a tunnel to the real UDD: vagrant ssh -c /vagrant/vagrant/setup-tunnel.sh
- import (parts of) the real UDD:
vagrant ssh -c '/vagrant/vagrant/populate-db.sh schema'
vagrant ssh -c '/vagrant/vagrant/populate-db.sh udd_logs'
"