...
 
Commits (3)
# Use an official Debian stable as a parent image
FROM debian:stable
RUN apt-get update && \
apt-get -y install sudo
RUN useradd -m docker && echo "docker:docker" | chpasswd && adduser docker sudo
# Copy the current directory contents into the container at /app
COPY docker/provision.sh .
# Install any needed packages specified in requirements.txt
RUN ./provision.sh
# Make HTTP port 80 available to the world outside this container
EXPOSE 80
# Make PostgreSQL port 5432 available to the world outside this container
EXPOSE 5432
# Define environment variable
ENV NAME Debian
COPY docker/startup.sh .
# Start apache2 & postgres
CMD ["./startup.sh"]
......@@ -2,7 +2,7 @@
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
config.vm.box = "debian/contrib-stretch64"
config.vm.box = "debian/stretch"
config.vm.network "forwarded_port", guest: 80, host: 8080
......
#!/bin/sh
set -x
set -e
sudo sed -i s/httpredir.debian.org/deb.debian.org/ /etc/apt/sources.list
sudo apt-get update
sudo apt-get install -y apache2 postgresql postgresql-plperl-9.6 postgresql-9.6-debversion ruby-debian ruby-oj rsync python-yaml python-psycopg2 ruby-pg ruby-sequel-pg
# trust local connections
sudo sed -ri 's/(local\s+all\s+all\s+)peer/\1trust/' /etc/postgresql/9.6/main/pg_hba.conf
sudo sed -ri 's/(host\s+all\s+all\s+127.0.0.1\/32\s+)md5/\1trust/' /etc/postgresql/9.6/main/pg_hba.conf
sudo sed -ri 's/(host\s+all\s+all\s+::1\/128\s+)md5/\1trust/' /etc/postgresql/9.6/main/pg_hba.conf
# use port 5452 (same as the real UDD instance on ullmann)
sudo sed -ri 's/^port = 5432/port = 5452/' /etc/postgresql/9.6/main/postgresql.conf
sudo sed -ri 's/^#checkpoint_segments = .*/checkpoint_segments = 256/' /etc/postgresql/9.6/main/postgresql.conf
sudo sed -ri 's/^#synchronous_commit = .*/synchronous_commit = off/' /etc/postgresql/9.6/main/postgresql.conf
sudo sed -ri 's/^#fsync = .*/fsync = off/' /etc/postgresql/9.6/main/postgresql.conf
sudo sed -ri 's/^#shared_buffers = .*/shared_buffers = 1GB/' /etc/postgresql/9.6/main/postgresql.conf
# restart postgresql
sudo service postgresql restart
# create and configure UDD database
sudo -u postgres dropuser udd || true
sudo -u postgres createuser -DRS udd
sudo -u postgres dropuser docker || true
sudo -u postgres createuser -DRS docker
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.
# We base it off 'template0' because 'template1' (the default) might be set to UTF8 which prevents creation
# of new SQL_ASCII databases.
sudo -u postgres psql udd -c 'CREATE EXTENSION debversion'
# Also create a guest user (used by CGIs)
sudo -u postgres dropuser guest || true
sudo -u postgres createuser -lDRS guest
sudo -u postgres psql udd -c 'GRANT usage ON schema public TO PUBLIC;'
sudo -u postgres psql udd -c 'GRANT select ON all tables in schema public TO PUBLIC;'
sudo mkdir -p /srv/udd.debian.org/
sudo ln -sfn /docker /srv/udd.debian.org/udd
# stop postgresql
sudo service postgresql stop
# apache setup
#
# This one gives a 'file not found' error:
# sudo ln -sf /docker/docker/apache.conf /etc/apache2/sites-enabled/000-default.conf
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 docker user. Yes, eek. But this avoids all permission problems.
sudo sed -i 's/APACHE_RUN_USER=www-data/APACHE_RUN_USER=docker/' /etc/apache2/envvars
sudo sed -i 's/APACHE_RUN_GROUP=www-data/APACHE_RUN_GROUP=docker/' /etc/apache2/envvars
sudo chown -R docker:docker /var/log/apache2
# This one gives a 'file not found' error:
# sudo chown -R docker:docker /var/lock/apache2
sudo service apache2 restart
#
sudo chown -R docker:docker /etc/apache2
# stop apache (just in case :)
sudo service apache2 stop
#!/bin/sh
# Start services
sudo service postgresql restart
sudo service apache2 restart
# Keep the container up :-)
tail -f /dev/null
......@@ -27,7 +27,7 @@ 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.
# We base it off 'template0' because 'template1' (the default) might be set to UTF8 which prevents creation
# of new SQL_ASCII databases.
sudo -upostgres psql udd -c 'CREATE EXTENSION debversion'
sudo -u postgres psql udd -c 'CREATE EXTENSION debversion'
# Also create a guest user (used by CGIs)
sudo -u postgres dropuser guest || true
sudo -u postgres createuser -lDRS guest
......@@ -41,10 +41,11 @@ sudo ln -sf /vagrant/vagrant/apache.conf /etc/apache2/sites-enabled/000-default.
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
sudo service apache2 restart
......