Skip to content
Snippets Groups Projects
Commit 30c9fc47 authored by Reinhold Kainhofer's avatar Reinhold Kainhofer
Browse files

Update to latest J3/VM3 full installer (automatic installation via cmd line), using PHP 7.0

Also addes ad-docker-vhost.sh and vm-docker-create.sh shell scripts to handle containers. These are not needed to run the containers, but make it easier for me to use the containers in my development environment
parent ee7becb7
No related branches found
No related tags found
No related merge requests found
all: j3vm3
j3vm3: FORCE
cd j3vm3_full && docker build -t registry.open-tools.net/opentools/docker-virtuemart/j3vm3:latest .
push:
cd j3vm3_full && docker push
FORCE:
#!/bin/bash
if [ $# -lt 2 ]; then
echo
echo " add-docker-vhost.sh DOMAINNAME PORT"
echo
echo " Add a virtual host entry for DOMAINNAME.test that ProxyPasses to the given port on localhost."
echo " Needs admin privileges and thus should be run through sudo."
exit
fi
NAME=$1
PORT=$2
sudo echo "<VirtualHost *:80>
ServerName $NAME.test
ServerAlias $NAME.lacolhost.com
ServerAdmin $NAME@demo.open-tools.net
ProxyPreserveHost on
ProxyPass / http://127.0.0.1:$PORT/
ProxyPassReverse / http://127.0.0.1:$PORT/
</VirtualHost>
" >> /etc/apache2/sites-enabled/development.conf
service apache2 restart
echo "Created virtual Host $NAME.test, proxied on port $PORT"
FROM php:5.6-apache FROM php:7.2-apache
MAINTAINER Reinhold Kainhofer <reinhold@kainhofer.com> MAINTAINER Reinhold Kainhofer <reinhold@kainhofer.com>
# Enable Apache Rewrite Module # Enable Apache Rewrite Module
...@@ -7,7 +7,7 @@ RUN a2enmod rewrite ...@@ -7,7 +7,7 @@ RUN a2enmod rewrite
RUN apt-get update RUN apt-get update
# Install PHP extensions # Install PHP extensions
RUN apt-get install -y libpng12-dev libjpeg-dev zip unzip sudo \ RUN apt-get install -y libpng-dev libjpeg-dev zip unzip sudo \
&& docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr \ && docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr \
&& docker-php-ext-install gd && docker-php-ext-install gd
RUN docker-php-ext-install mysqli RUN docker-php-ext-install mysqli
...@@ -24,10 +24,10 @@ RUN apt-get install -y supervisor ...@@ -24,10 +24,10 @@ RUN apt-get install -y supervisor
# Define Joomla version and expected SHA1 signature # Define Joomla version and expected SHA1 signature
ENV J_VERSION 3.6.2 ENV J_VERSION 3.8.3
ENV VM_VERSION 3.0.18 ENV VM_VERSION 3.2.12
ENV VM_DLDIR 1023 ENV VM_DLDIR 1112
ENV VM_MD5 2a94ed631d8b6765e8b4f7983e53c24c ENV VM_MD5 e26312d5f1b28d58cece51a160f8cbe6
ENV VM_POSTFIX "" ENV VM_POSTFIX ""
# Download package and extract to web volume # Download package and extract to web volume
......
...@@ -18,7 +18,8 @@ if [[ ! -e "/etc/opentools-docker-configured" ]]; then ...@@ -18,7 +18,8 @@ if [[ ! -e "/etc/opentools-docker-configured" ]]; then
fi fi
# If the DB user is 'root' and no DB password is given, then use the MySQL root password env var # If the DB user is 'root' and no DB password is given, then use the MySQL root password env var
: ${JOOMLA_DB_USER:=root} : ${JOOMLA_DB_NAME:=virtuemart}
: ${JOOMLA_DB_USER:=virtuemart}
if [ "$JOOMLA_DB_USER" = 'root' ]; then if [ "$JOOMLA_DB_USER" = 'root' ]; then
: ${JOOMLA_DB_PASSWORD:=$MYSQL_ENV_MYSQL_ROOT_PASSWORD} : ${JOOMLA_DB_PASSWORD:=$MYSQL_ENV_MYSQL_ROOT_PASSWORD}
fi fi
...@@ -31,10 +32,10 @@ if [[ ! -e "/etc/opentools-docker-configured" ]]; then ...@@ -31,10 +32,10 @@ if [[ ! -e "/etc/opentools-docker-configured" ]]; then
MYSQL_LOCAL=1 MYSQL_LOCAL=1
JOOMLA_DB_HOST="127.0.0.1" JOOMLA_DB_HOST="127.0.0.1"
if [ -z "${JOOMLA_DB_PASSWORD}" ]; then if [ -z "${JOOMLA_DB_PASSWORD}" ]; then
JOOMLA_DB_PASSWORD='root' JOOMLA_DB_PASSWORD='virtuemart'
echo >&2 "No MySQL root password given. Assuming password 'root'." echo >&2 "No MySQL password given. Assuming password 'virtuemart'."
fi fi
echo >&2 " Root password is ${JOOMLA_DB_PASSWORD}." echo >&2 " MySQL password is ${JOOMLA_DB_PASSWORD} for user ${JOOMLA_DB_USER}."
# Temporarily start the mysql daemon to set up the database and shut it # Temporarily start the mysql daemon to set up the database and shut it
# down again (supervisord will start it at the very end) # down again (supervisord will start it at the very end)
...@@ -52,7 +53,9 @@ if [[ ! -e "/etc/opentools-docker-configured" ]]; then ...@@ -52,7 +53,9 @@ if [[ ! -e "/etc/opentools-docker-configured" ]]; then
sleep 1 sleep 1
done done
echo echo
mysqladmin --password=root password "${JOOMLA_DB_PASSWORD}" /usr/bin/mysqladmin --user=root --password=root status
/usr/bin/mysqladmin --user=root --password=root create "${JOOMLA_DB_NAME}"
echo "GRANT ALL PRIVILEGES ON *.* to '${JOOMLA_DB_USER}'@'%' IDENTIFIED BY '${JOOMLA_DB_PASSWORD}';" | mysql --user=root --password=root ${JOOMLA_DB_NAME}
# enable mysqld in the supervisor config # enable mysqld in the supervisor config
cp /etc/supervisor/conf.d/mysql.conf.save /etc/supervisor/conf.d/mysql.conf cp /etc/supervisor/conf.d/mysql.conf.save /etc/supervisor/conf.d/mysql.conf
...@@ -60,7 +63,6 @@ if [[ ! -e "/etc/opentools-docker-configured" ]]; then ...@@ -60,7 +63,6 @@ if [[ ! -e "/etc/opentools-docker-configured" ]]; then
# Now set up the Database for Joomla/VirtueMart: # Now set up the Database for Joomla/VirtueMart:
: ${JOOMLA_DB_NAME:=virtuemart}
if [ -z "$JOOMLA_DB_PASSWORD" ]; then if [ -z "$JOOMLA_DB_PASSWORD" ]; then
echo >&2 "error: missing required JOOMLA_DB_PASSWORD environment variable" echo >&2 "error: missing required JOOMLA_DB_PASSWORD environment variable"
...@@ -102,10 +104,14 @@ if [[ ! -e "/etc/opentools-docker-configured" ]]; then ...@@ -102,10 +104,14 @@ if [[ ! -e "/etc/opentools-docker-configured" ]]; then
chown www-data:www-data .htaccess chown www-data:www-data .htaccess
fi fi
echo "database host: $JOOMLA_DB_HOST"
echo
sed 's/default="localhost"/default="'$JOOMLA_DB_HOST'"/; sed 's/default="localhost"/default="'$JOOMLA_DB_HOST'"/;
s/\(db_user.*\)$/\1 default="'$JOOMLA_DB_USER'"/; s/default="127.0.0.1"/default="'$JOOMLA_DB_HOST'"/;
s/\(db_pass.*\)$/\1 default="'$JOOMLA_DB_PASSWORD'"/; s/\(name=.*db_user.*\)$/\1 default="'$JOOMLA_DB_USER'"/;
s/\(db_name.*\)$/\1 default="'$JOOMLA_DB_NAME'"/' installation/model/forms/database.xml > installation/model/forms/database.xml.new s/\(name=.*db_pass.*\)$/\1 default="'$JOOMLA_DB_PASSWORD'"/;
s/\(name=.*db_name.*\)$/\1 default="'$JOOMLA_DB_NAME'"/;
' installation/model/forms/database.xml > installation/model/forms/database.xml.new
mv installation/model/forms/database.xml.new installation/model/forms/database.xml mv installation/model/forms/database.xml.new installation/model/forms/database.xml
echo >&2 "Complete! Virtuemart has been successfully copied to $(pwd)" echo >&2 "Complete! Virtuemart has been successfully copied to $(pwd)"
...@@ -116,16 +122,24 @@ if [[ ! -e "/etc/opentools-docker-configured" ]]; then ...@@ -116,16 +122,24 @@ if [[ ! -e "/etc/opentools-docker-configured" ]]; then
: ${JOOMLA_ADMIN_PASSWORD:=admin} : ${JOOMLA_ADMIN_PASSWORD:=admin}
: ${JOOMLA_ADMIN_EMAIL:=admin@example.com} : ${JOOMLA_ADMIN_EMAIL:=admin@example.com}
: ${JOOMLA_SITE_NAME:=Joomla Installation} : ${JOOMLA_SITE_NAME:=Joomla Installation}
if [ -z "$JOOMLA_DB_PREFIX" ]; then if [ -n "$JOOMLA_DB_PREFIX" ]; then
DBPREFIX="--dbprefix=\"${JOOMLA_DB_PREFIX}_\"" DBPREFIX="--db-prefix=\"${JOOMLA_DB_PREFIX}_\""
fi fi
# echo "Installing Joomla/VirtueMart site $JOOMLA_SITE_NAME using the CLI and database host $JOOMLA_DB_HOST" # insert the access and site values in the installer forms so that the user only has to press the buttons to install
# php ./installation/install.php --name "$JOOMLA_SITE_NAME" \ sed 's/\(name=.*site_name.*\)$/\1 default="'"${JOOMLA_SITE_NAME}"'"/;
# --admin-user "$JOOMLA_ADMIN_USER" --admin-pass "$JOOMLA_ADMIN_PASSWORD" --admin-email "$JOOMLA_ADMIN_EMAIL" \ s/\(name=.*admin_email.*\)$/\1 default="'$JOOMLA_ADMIN_EMAIL'"/;
# --db-host "$JOOMLA_DB_HOST" --db-user "$JOOMLA_DB_USER" --db-pass "$JOOMLA_DB_PASSWORD" --db-name "$JOOMLA_DB_NAME" $DBPREFIX && \ s/\(name=.*admin_user.*\)$/\1 default="'$JOOMLA_ADMIN_USER'"/;
# rm -rf "./installation/" s/\(name=.*admin_password.*\)$/\1 default="'$JOOMLA_ADMIN_PASSWORD'"/;
# chown www-data:www-data configuration.php ' installation/model/forms/site.xml > installation/model/forms/site.xml.new
mv installation/model/forms/site.xml.new installation/model/forms/site.xml
echo "Installing Joomla/VirtueMart site $JOOMLA_SITE_NAME using the CLI and database host $JOOMLA_DB_HOST"
sudo -u www-data php ./installation/install.php --name="$JOOMLA_SITE_NAME" \
--admin-user="$JOOMLA_ADMIN_USER" --admin-pass="$JOOMLA_ADMIN_PASSWORD" --admin-email="$JOOMLA_ADMIN_EMAIL" \
--db-host="$JOOMLA_DB_HOST" --db-user="$JOOMLA_DB_USER" --db-pass="$JOOMLA_DB_PASSWORD" --db-name="$JOOMLA_DB_NAME" --sample="sample_virtuemart.sql" $DBPREFIX && \
rm -rf "./installation/"
chown www-data:www-data configuration.php
for p in /usr/src/virtuemart/*.zip; do for p in /usr/src/virtuemart/*.zip; do
......
#!/bin/bash
REPO=registry.open-tools.net/opentools/docker-virtuemart/j3vm3:latest
if [ $# -lt 3 ]; then
echo "Usage: vm-docker-create.sh NAME PORT SITE_NAME"
exit
fi
NAME=$1
PORT=$2
SITE=$3
SCRIPTDIR="$(dirname "$0")"
docker run -p $PORT:80 -d --name vm-$NAME -e JOOMLA_DB_USER=virtuemart -e JOOMLA_DB_PASSWORD=virtuemart -e JOOMLA_ADMIN_USER=opentools -e JOOMLA_ADMIN_PASSWORD=opentools -e JOOMLA_DB_NAME=vm_$NAME -e JOOMLA_SITE_NAME="${SITE}" -e JOOMLA_ADMIN_EMAIL="demo@demo.open-tools.net" $REPO
sudo $SCRIPTDIR/add-docker-vhost.sh vm-$NAME $PORT
echo "Please direct your browser to the newly installed site to finalize your Virtuemart installation:
http://vm-$NAME.test/
User: opentools
Pass: opentools
"
# docker exec -ti wc-$NAME /install-wc.sh "wc-${NAME}.test" "$SITE"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment