aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSam Pearson <sam@sgp.me.uk>2018-09-18 16:28:15 +0100
committerSam Pearson <sam@sgp.me.uk>2018-09-28 14:35:46 +0100
commitf8aed6f02cf5084a43375d8680a2e5fafb761529 (patch)
treefaf57711559de16fb1435b97125d43f0a91211cf
parent43845231cccbea8abd37930c480ed46349ca1de3 (diff)
[Docker] Support Docker builds in install scripts
- Adds support for additional variables intended to control when to install postfix and postgres. - Skips nginx setup and integration when performing a docker build. - Don't print usage during docker build
-rwxr-xr-xbin/install-as-user23
-rw-r--r--bin/site-specific-install.sh26
-rw-r--r--conf/packages.docker15
3 files changed, 48 insertions, 16 deletions
diff --git a/bin/install-as-user b/bin/install-as-user
index e42401758..7e2a0bd74 100755
--- a/bin/install-as-user
+++ b/bin/install-as-user
@@ -25,6 +25,8 @@ misuse() {
}
[ -z "$DEVELOPMENT_INSTALL" ] && misuse DEVELOPMENT_INSTALL
+[ -z "$DOCKER" ] && misuse DOCKER
+[ -z "$INSTALL_DB" ] && misuse INSTALL_DB
DB_NAME="fixmystreet"
@@ -92,19 +94,20 @@ then
fi
echo $DONE_MSG
-# Create the database if it doesn't exist:
-echo -n "Setting up database... "
-if ! psql -l | egrep "^ *$DB_NAME *\|" > /dev/null
-then
- createdb --owner "$UNIX_USER" "$DB_NAME"
- echo 'CREATE LANGUAGE plpgsql;' | psql -U "$UNIX_USER" "$DB_NAME" || true
+if [ $INSTALL_DB = true ]; then
+ # Create the database if it doesn't exist:
+ echo -n "Setting up database... "
+ if ! psql -l | egrep "^ *$DB_NAME *\|" > /dev/null
+ then
+ createdb --owner "$UNIX_USER" "$DB_NAME"
+ echo 'CREATE LANGUAGE plpgsql;' | psql -U "$UNIX_USER" "$DB_NAME" || true
+ fi
+ bin/update-schema --commit
+ bin/update-all-reports
+ echo $DONE_MSG
fi
-bin/update-schema --commit
-echo $DONE_MSG
# Generate po and mo files (these invocations taken from Kagee's script):
echo "Creating locale .mo files"
commonlib/bin/gettext-makemo FixMyStreet
echo $DONE_MSG
-
-bin/update-all-reports
diff --git a/bin/site-specific-install.sh b/bin/site-specific-install.sh
index a92f92ef5..4d7f05f1e 100644
--- a/bin/site-specific-install.sh
+++ b/bin/site-specific-install.sh
@@ -26,27 +26,41 @@ misuse() {
[ -z "$DISTRIBUTION" ] && misuse DISTRIBUTION
[ -z "$VERSION" ] && misuse VERSION
[ -z "$DEVELOPMENT_INSTALL" ] && misuse DEVELOPMENT_INSTALL
+[ -z "$DOCKER" ] && misuse DOCKER
+[ -z "$INSTALL_DB" ] && misuse INSTALL_DB
+[ -z "$INSTALL_POSTFIX" ] && misuse INSTALL_POSTFIX
add_locale cy_GB
add_locale nb_NO
add_locale de_CH
-install_postfix
+if [ $INSTALL_POSTFIX = true ]; then
+ install_postfix
+fi
if [ ! "$DEVELOPMENT_INSTALL" = true ]; then
- install_nginx
- add_website_to_nginx
+ if [ ! "$DOCKER" = true ]; then
+ install_nginx
+ add_website_to_nginx
+ fi
# Check out the current released version
su -l -c "cd '$REPOSITORY' && git checkout '$VERSION' && git submodule update" "$UNIX_USER"
fi
+# Create a log directoryfor Docker builds - this is normally done above.
+if [ $DOCKER = true ]; then
+ make_log_directory
+fi
+
install_website_packages
su -l -c "touch '$DIRECTORY/admin-htpasswd'" "$UNIX_USER"
-add_postgresql_user
+if [ $INSTALL_DB = true ]; then
+ add_postgresql_user
+fi
-export DEVELOPMENT_INSTALL
+export DEVELOPMENT_INSTALL DOCKER INSTALL_DB
su -c "$REPOSITORY/bin/install-as-user '$UNIX_USER' '$HOST' '$DIRECTORY'" "$UNIX_USER"
if [ ! "$DEVELOPMENT_INSTALL" = true ]; then
@@ -61,7 +75,7 @@ then
overwrite_rc_local
fi
-if [ ! "$DEVELOPMENT_INSTALL" = true ]; then
+if [ ! "$DEVELOPMENT_INSTALL" = true ] && [ ! "$DOCKER" = true ]; then
# Tell the user what to do next:
echo Installation complete - you should now be able to view the site at:
diff --git a/conf/packages.docker b/conf/packages.docker
new file mode 100644
index 000000000..ed1b46611
--- /dev/null
+++ b/conf/packages.docker
@@ -0,0 +1,15 @@
+make
+g++
+jhead
+liblocale-gettext-perl
+perl
+perlmagick
+libmath-bigint-gmp-perl
+gettext
+postgresql-server-dev-all
+postgresql-client
+gnuplot
+ttf-bitstream-vera
+libexpat1-dev
+libssl-dev
+zlib1g-dev