Commit a41b1db4 authored by Michiel de Jong's avatar Michiel de Jong

move lamp-git family images from dockerfiles to indiehosters-docker-bash repo

parent da59432a
FROM indiehosters/lamp-git
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update \
&& apt-get -yq install \
pwgen \
&& rm -rf /var/lib/apt/lists/*
RUN cd /init && curl -L http://assets.withknown.com/releases/known-0.6.5.tgz
COPY init/known.sh /init/known.sh
COPY init/config.ini /init/config.ini
# wordpress-git
This image adds WordPress to the lamp-git image, using WP-CLI.
````
sudo docker build -t indiehosters/wordpress-git .
sudo docker run -d -v $(pwd)/data:/data indiehosters/wordpress-git
````
database = 'MySQL'
dbhost = 'localhost'
dbname = 'known'
dbuser = 'root'
dbpass = ''
filesystem = 'local'
uploadpath = '/data/uploads/'
#!/bin/bash
VERSION="0.6.5"
echo "Extracting Known $(VERSION}..."
cd /data/www-content
tar xzf /init/known-$VERSION.tgz
echo "Setting default config..."
cp /init/config.ini .
echo "Creating empty database..."
echo "CREATE DATABASE IF NOT EXISTS known" | mysql
PWD=`pwgen 40 1`
echo "user: " > /data/login.txt
echo "pass: $PWD" >> /data/login.txt
echo "Please use your browser to set up a user, and edit /data/login.txt manually:"
cat /data/login.txt
if [ $# -lt 4 ]; then
echo Usage: ./wordpress.sh https://exampledomain.com/ "Example Domain" "example" "example@elsewhere.com"
exit 1
fi
echo Unpacking latest WordPress into /data/www-content...
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
php /root/wp-cli.phar --path="/data/www-content" --allow-root core download
php /root/wp-cli.phar --path="/data/www-content" --allow-root core config --dbname=wordpress --dbuser=root
php /root/wp-cli.phar --path="/data/www-content" --allow-root db create
# pwgen is not part of the runtime lamp-git image:
apt-get update
apt-get install -y pwgen
PWD=`pwgen 40 1`
php /root/wp-cli.phar --path="/data/www-content" --allow-root core install \
--url="$1" --title="$2" --admin_user="$3" --admin_password="$PWD" --admin_email="$4" \
--extra-php="define("FS_METHOD","direct"); define("FS_CHMOD_DIR", 0777); define("FS_CHMOD_FILE", 0777);"
#TODO: Debug if/why this is necessary:
php /root/wp-cli.phar --path="/data/www-content" --allow-root user update $3 --user_pass="$PWD"
echo Installing the IndieWeb plugins...
php /root/wp-cli.phar --path="/data/www-content" --allow-root plugin delete akismet
php /root/wp-cli.phar --path="/data/www-content" --allow-root plugin delete hello
php /root/wp-cli.phar --path="/data/www-content" --allow-root plugin install wordpress-https
php /root/wp-cli.phar --path="/data/www-content" --allow-root plugin activate wordpress-https
php /root/wp-cli.phar --path="/data/www-content" --allow-root plugin install indieauth
php /root/wp-cli.phar --path="/data/www-content" --allow-root plugin activate indieauth
php /root/wp-cli.phar --path="/data/www-content" --allow-root plugin install semantic-linkbacks
php /root/wp-cli.phar --path="/data/www-content" --allow-root plugin activate semantic-linkbacks
php /root/wp-cli.phar --path="/data/www-content" --allow-root plugin install webmention
php /root/wp-cli.phar --path="/data/www-content" --allow-root plugin activate webmention
php /root/wp-cli.phar --path="/data/www-content" --allow-root plugin install hum
php /root/wp-cli.phar --path="/data/www-content" --allow-root plugin activate hum
php /root/wp-cli.phar --path="/data/www-content" --allow-root plugin install https://github.com/pfefferle/wordpress-indieweb-press-this/archive/master.zip
php /root/wp-cli.phar --path="/data/www-content" --allow-root plugin activate wordpress-indieweb-press-this-master
php /root/wp-cli.phar --path="/data/www-content" --allow-root plugin install https://github.com/dshanske/indieweb-taxonomy/archive/master.zip
php /root/wp-cli.phar --path="/data/www-content" --allow-root plugin activate indieweb-taxonomy-master
php /root/wp-cli.phar --path="/data/www-content" --allow-root plugin install https://github.com/pfefferle/wordpress-webactions/archive/master.zip
php /root/wp-cli.phar --path="/data/www-content" --allow-root plugin activate wordpress-webactions-master
php /root/wp-cli.phar --path="/data/www-content" --allow-root plugin install https://github.com/pfefferle/wordpress-webmention-for-comments/archive/master.zip
php /root/wp-cli.phar --path="/data/www-content" --allow-root plugin activate wordpress-webmention-for-comments-master
php /root/wp-cli.phar --path="/data/www-content" --allow-root plugin install indieweb
php /root/wp-cli.phar --path="/data/www-content" --allow-root plugin activate indieweb
php /root/wp-cli.phar --path="/data/www-content" --allow-root theme install sempress
php /root/wp-cli.phar --path="/data/www-content" --allow-root theme activate sempress
php /root/wp-cli.phar --path="/data/www-content" --allow-root theme install wpsupercache
php /root/wp-cli.phar --path="/data/www-content" --allow-root theme activate wpsupercache
echo Making WordPress content folder writable for the webserver...
chown -R root:www-data /data/www-content
chmod 770 /data/www-content/wp-content
echo "user: $3" > /data/login.txt
echo "pass: $PWD" >> /data/login.txt
echo "Done, login details saved to /data/login.txt"
FROM debian:jessie
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update \
&& apt-get -yq install \
apache2 \
curl \
git \
libapache2-mod-php5 \
mysql-client \
mysql-server-5.5 \
php-apc \
php-pear \
php5-curl \
php5-gd \
php5-mysql \
php5-xmlrpc \
&& rm -rf /var/lib/apt/lists/*
# Add image configuration and scripts
COPY apache.conf /etc/apache2/sites-enabled/000-default.conf
COPY init /init
COPY run.sh /run.sh
RUN sed -i "s/variables_order.*/variables_order = \"EGPCS\"/g" /etc/php5/apache2/php.ini \
&& a2enmod rewrite \
&& chmod 755 /run.sh
CMD ["/run.sh"]
EXPOSE 80
# lamp-git
This image pulls in a database dump and a www-content folder from a git repo, and hosts it as a lamp application.
````
sudo docker build -t indiehosters/lamp-git .
sudo docker run -d -v $(pwd)/data:/data indiehosters/lamp-git
````
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
ServerAdmin webmaster@localhost
DocumentRoot /data/www-content
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
<Directory /data/www-content/>
Options -Indexes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
#!/bin/bash
mkdir -p /data/uploads
mkdir -p /data/www-content
touch /data/www-content/.htaccess
touch /data/dump.sql
chown -R root:www-data /data
chmod -R 770 /data/uploads
chmod -R 750 /data/www-content
cd /data
git init
git config --local user.email "backup@IndieHosters"
git config --local user.name "IndieHosters backup"
#!/bin/bash
exec mysqld_safe &
for ((i=0;i<10;i++))
do
DB_CONNECTABLE=$(mysql -e 'status' >/dev/null 2>&1; echo "$?")
if [[ DB_CONNECTABLE -eq 0 ]]; then
break
fi
echo "Waiting for database server..."
sleep 1
done
mysql < /data/dump.sql
source /etc/apache2/envvars
exec apache2 &
cd /data
while true; do
mysqldump --all-databases > dump.sql
git add *
git commit -am"backup `date`"
git status
date
echo "Next backup in one hour..."
sleep 3540
done
FROM indiehosters/lamp-git
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update \
&& apt-get -yq install \
bzip2 \
pwgen \
&& rm -rf /var/lib/apt/lists/*
RUN cd /init && curl -O https://download.owncloud.org/community/owncloud-7.0.2.tar.bz2
COPY init/owncloud.sh /init/owncloud.sh
COPY init/config.php /init/config.php
# owncloud-git
This image adds ownCloud to the lamp-git image:
````
sudo docker build -t indiehosters/owncloud-git .
sudo docker run -it -v $(pwd)/data:/data -p 80:80 indiehosters/owncloud-git /bin/bash
````
And inside:
````
sh /run.sh &
sh /init/generic.sh
sh /init/owncloud.sh
exit
````
Now you don't need this specific image anymore, but can run your instance with the generic lamp-git image:
````
sudo docker build -t indiehosters/lamp-git .
sudo docker run -it -v $(pwd)/data:/data -p 80:80 indiehosters/lamp-git /bin/bash
````
#!/bin/bash
VERSION="7.0.2"
echo "Extracting ownCloud ${VERSION}..."
cd /data
tar xjf /init/owncloud-$VERSION.tar.bz2
rm -rf www-content
mv owncloud www-content
echo "Setting default config..."
cp /init/config.php ./www-content
chown -R root:www-data /data/www-content
chmod -R g+w /data/www-content
echo "Creating empty database..."
echo "CREATE DATABASE IF NOT EXISTS owncloud" | mysql
PWD=`pwgen 40 1`
echo "user: " > /data/login.txt
echo "pass: $PWD" >> /data/login.txt
echo "Please use your browser to set up a user, and edit /data/login.txt manually:"
cat /data/login.txt
FROM indiehosters/lamp-git
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update \
&& apt-get -yq install \
pwgen \
&& rm -rf /var/lib/apt/lists/*
RUN cd /root && curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
COPY init/wordpress.sh /init/wordpress.sh
# wordpress-git
This image adds WordPress to the lamp-git image, using WP-CLI.
````
sudo docker build -t indiehosters/wordpress-git .
sudo docker run -d -v $(pwd)/data:/data indiehosters/wordpress-git
````
if [ $# -lt 4 ]; then
echo Usage: ./wordpress.sh https://exampledomain.com/ "Example Domain" "example" "example@elsewhere.com"
exit 1
fi
echo Unpacking latest WordPress into /data/www-content...
php /root/wp-cli.phar --path="/data/www-content" --allow-root core download
php /root/wp-cli.phar --path="/data/www-content" --allow-root core config --dbname=wordpress --dbuser=root
php /root/wp-cli.phar --path="/data/www-content" --allow-root db create
# pwgen is not part of the runtime lamp-git image:
apt-get update
apt-get install -y pwgen
PWD=`pwgen 40 1`
php /root/wp-cli.phar --path="/data/www-content" --allow-root core install \
--url="$1" --title="$2" --admin_user="$3" --admin_password="$PWD" --admin_email="$4" \
--extra-php="define("FS_METHOD","direct"); define("FS_CHMOD_DIR", 0777); define("FS_CHMOD_FILE", 0777);"
#TODO: Debug if/why this is necessary:
php /root/wp-cli.phar --path="/data/www-content" --allow-root user update $3 --user_pass="$PWD"
echo Installing the IndieWeb plugins...
php /root/wp-cli.phar --path="/data/www-content" --allow-root plugin delete akismet
php /root/wp-cli.phar --path="/data/www-content" --allow-root plugin delete hello
php /root/wp-cli.phar --path="/data/www-content" --allow-root plugin install wordpress-https
php /root/wp-cli.phar --path="/data/www-content" --allow-root plugin activate wordpress-https
php /root/wp-cli.phar --path="/data/www-content" --allow-root plugin install indieauth
php /root/wp-cli.phar --path="/data/www-content" --allow-root plugin activate indieauth
php /root/wp-cli.phar --path="/data/www-content" --allow-root plugin install semantic-linkbacks
php /root/wp-cli.phar --path="/data/www-content" --allow-root plugin activate semantic-linkbacks
php /root/wp-cli.phar --path="/data/www-content" --allow-root plugin install webmention
php /root/wp-cli.phar --path="/data/www-content" --allow-root plugin activate webmention
php /root/wp-cli.phar --path="/data/www-content" --allow-root plugin install hum
php /root/wp-cli.phar --path="/data/www-content" --allow-root plugin activate hum
php /root/wp-cli.phar --path="/data/www-content" --allow-root plugin install https://github.com/pfefferle/wordpress-indieweb-press-this/archive/master.zip
php /root/wp-cli.phar --path="/data/www-content" --allow-root plugin activate wordpress-indieweb-press-this-master
php /root/wp-cli.phar --path="/data/www-content" --allow-root plugin install https://github.com/dshanske/indieweb-taxonomy/archive/master.zip
php /root/wp-cli.phar --path="/data/www-content" --allow-root plugin activate indieweb-taxonomy-master
php /root/wp-cli.phar --path="/data/www-content" --allow-root plugin install https://github.com/pfefferle/wordpress-webactions/archive/master.zip
php /root/wp-cli.phar --path="/data/www-content" --allow-root plugin activate wordpress-webactions-master
php /root/wp-cli.phar --path="/data/www-content" --allow-root plugin install https://github.com/pfefferle/wordpress-webmention-for-comments/archive/master.zip
php /root/wp-cli.phar --path="/data/www-content" --allow-root plugin activate wordpress-webmention-for-comments-master
php /root/wp-cli.phar --path="/data/www-content" --allow-root plugin install indieweb
php /root/wp-cli.phar --path="/data/www-content" --allow-root plugin activate indieweb
php /root/wp-cli.phar --path="/data/www-content" --allow-root theme install sempress
php /root/wp-cli.phar --path="/data/www-content" --allow-root theme activate sempress
php /root/wp-cli.phar --path="/data/www-content" --allow-root theme install wpsupercache
php /root/wp-cli.phar --path="/data/www-content" --allow-root theme activate wpsupercache
echo Making WordPress content folder writable for the webserver...
chown -R root:www-data /data/www-content
chmod 770 /data/www-content/wp-content
echo "user: $3" > /data/login.txt
echo "pass: $PWD" >> /data/login.txt
echo "Done, login details saved to /data/login.txt"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment