Commit 5c0c5804 authored by Michiel de Jong's avatar Michiel de Jong

Add Known from same lamp image as WordPress, closes #32

parent 3b2f46c9
[submodule "server-wide/yunohost"]
path = server-wide/yunohost
url = https://github.com/michielbdejong/YunoHost-install_script.git
[submodule "per-user/idno"]
path = per-user/idno
url = https://github.com/michielbdejong/idno.git
[submodule "per-user/owncloud"]
path = per-user/owncloud
url = https://github.com/michielbdejong/owncloud-core.git
[submodule "per-user/anchorcms"]
path = per-user/anchorcms
url = https://github.com/michielbdejong/anchor-cms.git
Subproject commit 8a588971ed50168291c732fd099a24e9dc5df2f6
Subproject commit e1f5b2f21475404f5a40073c0fde5f02b38842e6
FROM indiehosters/lamp
# Download latest version of Known into /app
RUN mkdir -p ; cd /app ; curl -L http://assets.withknown.com/releases/known-0.6.4.tgz | tar xz
RUN mkdir /uploads
RUN chown www-data:www-data /uploads
RUN cp /app/schemas/mysql/mysql.sql /initial_db.sql
ADD config.ini /app/config.ini
RUN mv /app/htaccess.dist /app/.htaccess
# Add script to create 'known' DB
ADD run-known.sh /run-known.sh
RUN chmod 755 /run-known.sh
# Expose environment variables
ENV DB_HOST **LinkMe**
ENV DB_PORT **LinkMe**
ENV DB_NAME known
ENV DB_USER admin
ENV DB_PASS **ChangeMe**
# to be cleaned up:
EXPOSE 80
VOLUME ["/app"]
CMD ["/run-known.sh"]
# Usage
PASS=`pwgen 20 1`
sudo docker pull debian:jessie
sudo docker build -t indiehosters/lamp ../lamp
sudo docker build -t indiehosters/known .
sudo docker run -d -e MYSQL_PASS=$PASS --name mysql indiehosters/mysql
sudo docker run -d -p 80:80 --link mysql:db -e DB_PASS=$PASS indiehosters/known
echo Using $PASS as the database password. Waiting for everything to be up...
sleep 20
curl -I http://localhost/
# This configuration file was created by Known's installer.
database = 'MySQL'
dbname = 'known'
dbpass = 'humptydumpty'
dbuser = 'admin'
dbhost = 'db'
filesystem = 'local'
uploadpath = '/uploads/'
#!/bin/bash
chown -R root:www-data /app
chmod -R 650 /app
chmod -R 770 /app/known-content/
chmod -R 660 /app/.htaccess
if [ -f /.mysql_db_created ]; then
exec /run.sh
exit 1
fi
DB_HOST=${DB_PORT_3306_TCP_ADDR:-${DB_HOST}}
DB_HOST=${DB_1_PORT_3306_TCP_ADDR:-${DB_HOST}}
DB_PORT=${DB_PORT_3306_TCP_PORT:-${DB_PORT}}
DB_PORT=${DB_1_PORT_3306_TCP_PORT:-${DB_PORT}}
if [ "$DB_PASS" = "**ChangeMe**" ] && [ -n "$DB_1_ENV_MYSQL_PASS" ]; then
DB_PASS="$DB_1_ENV_MYSQL_PASS"
fi
echo "=> Trying to connect to MySQL/MariaDB using:"
echo "========================================================================"
echo " Database Host Address: $DB_HOST"
echo " Database Port number: $DB_PORT"
echo " Database Name: $DB_NAME"
echo " Database Username: $DB_USER"
echo " Database Password: $DB_PASS"
echo "========================================================================"
echo "database = 'MySQL'" > /app/config.ini
echo "dbhost = '$DB_HOST'" >> /app/config.ini
echo "dbname = '$DB_NAME'" >> /app/config.ini
echo "dbuser = '$DB_USER'" >> /app/config.ini
echo "dbpass = '$DB_PASS'" >> /app/config.ini
echo "filesystem = 'local'" >> /app/config.ini
echo "uploadpath = '/uploads/'" >> /app/config.ini
chown root:www-data /app/config.ini
chmod 640 /app/config.ini
for ((i=0;i<10;i++))
do
DB_CONNECTABLE=$(mysql -u$DB_USER -p$DB_PASS -h$DB_HOST -P$DB_PORT -e 'status' >/dev/null 2>&1; echo "$?")
if [[ DB_CONNECTABLE -eq 0 ]]; then
break
fi
sleep 5
done
if [[ $DB_CONNECTABLE -eq 0 ]]; then
DB_EXISTS=$(mysql -u$DB_USER -p$DB_PASS -h$DB_HOST -P$DB_PORT -e "SHOW DATABASES LIKE '"$DB_NAME"';" 2>&1 |grep "$DB_NAME" > /dev/null ; echo "$?")
if [[ DB_EXISTS -eq 1 ]]; then
echo "=> Creating database $DB_NAME"
RET=$(mysql -u$DB_USER -p$DB_PASS -h$DB_HOST -P$DB_PORT -e "CREATE DATABASE $DB_NAME")
if [[ RET -ne 0 ]]; then
echo "Cannot create database for known"
exit RET
fi
if [ -f /initial_db.sql ]; then
echo "=> Loading initial database data to $DB_NAME"
RET=$(mysql -u$DB_USER -p$DB_PASS -h$DB_HOST -P$DB_PORT $DB_NAME < /initial_db.sql)
if [[ RET -ne 0 ]]; then
echo "Cannot load initial database data for known"
exit RET
fi
fi
echo "=> Done!"
else
echo "=> Skipped creation of database $DB_NAME – it already exists."
fi
else
echo "Cannot connect to Mysql"
exit $DB_CONNECTABLE
fi
touch /.mysql_db_created
exec /run.sh
......@@ -2,29 +2,29 @@ FROM debian:jessie
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && \
apt-get -yq install \
curl \
apache2 \
mysql-client \
libapache2-mod-php5 \
php5-mysql \
php5-gd \
php5-curl \
php-pear \
php-apc && \
rm -rf /var/lib/apt/lists/*
RUN apt-get update \
&& apt-get -yq install \
apache2 \
curl \
mysql-client \
libapache2-mod-php5 \
php-apc \
php-pear \
php5-curl \
php5-gd \
php5-mysql \
php5-xmlrpc \
&& rm -rf /var/lib/apt/lists/*
# Add image configuration and scripts
ADD default.conf /etc/apache2/sites-enabled/000-default.conf
ADD run.sh /run.sh
RUN sed -i "s/variables_order.*/variables_order = \"EGPCS\"/g" /etc/php5/apache2/php.ini && \
mkdir -p /app && \
rm -rf /var/www/html && \
ln -s /app /var/www/html && \
a2enmod rewrite && \
chmod 755 /run.sh
RUN sed -i "s/variables_order.*/variables_order = \"EGPCS\"/g" /etc/php5/apache2/php.ini \
&& mkdir -p /app \
&& rm -rf /var/www/html \
&& ln -s /app /var/www/html \
&& a2enmod rewrite \
&& chmod 755 /run.sh
CMD ["/run.sh"]
EXPOSE 80
Subproject commit 53aa53db715cd54e6d30e6fc5938a078bd0364cc
FROM indiehosters/lamp
# Download latest version of ownCloud into /app
RUN apt-get update && \
apt-get -yq install \
bzip2 && \
curl -L https://download.owncloud.org/community/owncloud-7.0.2.tar.bz2 \
| tar xj && \
mv owncloud/* app && \
apt-get -yq remove bzip2 && \
apt-get -yq autoclean && \
rm -rf /var/lib/apt/lists/*
ADD oc-config.php /app/oc-config.php
# Add script to create 'owncloud' DB
ADD run-owncloud.sh /run-owncloud.sh
RUN chmod 755 /run-owncloud.sh
RUN chmod -R 775 /app/config
# Expose environment variables
ENV DB_HOST **LinkMe**
ENV DB_PORT **LinkMe**
ENV DB_NAME owncloud
ENV DB_USER admin
ENV DB_PASS **ChangeMe**
EXPOSE 80
VOLUME ["/app"]
CMD ["/run-owncloud.sh"]
# Work in progress
This image doesn't work yet, still needs some permissions tweaking and such.
# Usage:
PASS=`pwgen 20 1`
sudo docker pull debian:jessie
sudo docker build -t indiehosters/lamp ../lamp
sudo docker build -t indiehosters/owncloud .
sudo docker run -d -e MYSQL_PASS=$PASS --name mysql indiehosters/mysql
sudo docker run -d -p 80:80 --link mysql:db -e DB_PASS=$PASS indiehosters/owncloud
echo Using $PASS as the database password. Waiting for everything to be up...
sleep 20
curl -I http://localhost/
<?php
/**
* The base configurations of the WordPress.
*
* This file has the following configurations: MySQL settings, Table Prefix,
* Secret Keys, WordPress Language, and ABSPATH. You can find more information
* by visiting {@link http://codex.owncloud.org/Editing_oc-config.php Editing
* oc-config.php} Codex page. You can get the MySQL settings from your web host.
*
* This file is used by the oc-config.php creation script during the
* installation. You don't have to use the web site, you can just copy this file
* to "oc-config.php" and fill in the values.
*
* @package WordPress
*/
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', getenv('DB_NAME'));
/** MySQL database username */
define('DB_USER', getenv('DB_USER'));
/** MySQL database password */
define('DB_PASSWORD', getenv('DB_PASS'));
/** MySQL hostname */
define('DB_HOST', getenv('DB_HOST').":".getenv('DB_PORT'));
/** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8');
/** The Database Collate type. Don't change this if in doubt. */
define('DB_COLLATE', '');
/**#@+
* Authentication Unique Keys and Salts.
*
* Change these to different unique phrases!
* You can generate these using the {@link https://api.owncloud.org/secret-key/1.1/salt/ WordPress.org secret-key service}
* You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.
*
* @since 2.6.0
*/
define('AUTH_KEY', '--w,=nO-t>g:EOH>e-ZXs!7x(: W4:}1A2$E?Sn9P>TW-[=:u[nc-eQ<vIi<6|wh');
define('SECURE_AUTH_KEY', 'PlM~WQ/9-~V:-3&be`nxuaghz@JyN!]SzVr_]lAM2b?QH(d(|`.z_;1jIE4kY&f+');
define('LOGGED_IN_KEY', 'K]6*uCb-m~>zj5C1krtu:>2VT(WlI/Jl5T~Pov2-`r+Zb5s3i6&aIN$*/+k/~sLN');
define('NONCE_KEY', '~; xvP`h^{Pl9zaD#/!f@M21BAk0#sKg>*P+=1LV+FY+;HNE)%Y`4(Xq|&})fCj^');
define('AUTH_SALT', 'A2|G[jvSLB+z dy S/ S>(lLyzxDvJ8(ps1(F%~x]eRD`UHv(h*IDjye+SYV-a;O');
define('SECURE_AUTH_SALT', '9cv/Hy~a;qr]4)i*udy-/$non@_:CU0SIdm-L[WH^k_}s:Jq[)HV,Wu8na<_;ef3');
define('LOGGED_IN_SALT', '{d*4OCrk9x`|cb-4EBK7=ewJ3D]y%z,7mSEd:8?=eP![zD.O`<Uubt-u%@TA+x T');
define('NONCE_SALT', 'z6G5thFC]JIW]|ZQIBgZ?zBb^!N#3-Un=)`!Xb/,Yd8[2&}.W{ITu?=PE0oZ,<8^');
/**#@-*/
/**
* WordPress Database Table prefix.
*
* You can have multiple installations in one database if you give each a unique
* prefix. Only numbers, letters, and underscores please!
*/
$table_prefix = 'oc_';
/**
* WordPress Localized Language, defaults to English.
*
* Change this to localize WordPress. A corresponding MO file for the chosen
* language must be installed to oc-content/languages. For example, install
* de_DE.mo to oc-content/languages and set OCLANG to 'de_DE' to enable German
* language support.
*/
define('OCLANG', '');
/**
* For developers: WordPress debugging mode.
*
* Change this to true to enable the display of notices during development.
* It is strongly recommended that plugin and theme developers use OC_DEBUG
* in their development environments.
*/
define('OC_DEBUG', false);
/* That's all, stop editing! Happy blogging. */
/** Absolute path to the WordPress directory. */
if ( !defined('ABSPATH') )
define('ABSPATH', dirname(__FILE__) . '/');
/** Sets up WordPress vars and included files. */
require_once(ABSPATH . 'oc-settings.php');
/** change permisssions for plugin installation */
define("FS_METHOD","direct");
define("FS_CHMOD_DIR", 0777);
define("FS_CHMOD_FILE", 0777);
#!/bin/bash
chown -R root:www-data /app
chmod -R 650 /app
chmod -R 770 /app/oc-content/
chmod -R 660 /app/.htaccess
if [ -f /.mysql_db_created ]; then
exec /run.sh
exit 1
fi
DB_HOST=${DB_PORT_3306_TCP_ADDR:-${DB_HOST}}
DB_HOST=${DB_1_PORT_3306_TCP_ADDR:-${DB_HOST}}
DB_PORT=${DB_PORT_3306_TCP_PORT:-${DB_PORT}}
DB_PORT=${DB_1_PORT_3306_TCP_PORT:-${DB_PORT}}
if [ "$DB_PASS" = "**ChangeMe**" ] && [ -n "$DB_1_ENV_MYSQL_PASS" ]; then
DB_PASS="$DB_1_ENV_MYSQL_PASS"
fi
echo "=> Trying to connect to MySQL/MariaDB using:"
echo "========================================================================"
echo " Database Host Address: $DB_HOST"
echo " Database Port number: $DB_PORT"
echo " Database Name: $DB_NAME"
echo " Database Username: $DB_USER"
echo " Database Password: $DB_PASS"
echo "========================================================================"
for ((i=0;i<10;i++))
do
DB_CONNECTABLE=$(mysql -u$DB_USER -p$DB_PASS -h$DB_HOST -P$DB_PORT -e 'status' >/dev/null 2>&1; echo "$?")
if [[ DB_CONNECTABLE -eq 0 ]]; then
break
fi
sleep 5
done
if [[ $DB_CONNECTABLE -eq 0 ]]; then
DB_EXISTS=$(mysql -u$DB_USER -p$DB_PASS -h$DB_HOST -P$DB_PORT -e "SHOW DATABASES LIKE '"$DB_NAME"';" 2>&1 |grep "$DB_NAME" > /dev/null ; echo "$?")
if [[ DB_EXISTS -eq 1 ]]; then
echo "=> Creating database $DB_NAME"
RET=$(mysql -u$DB_USER -p$DB_PASS -h$DB_HOST -P$DB_PORT -e "CREATE DATABASE $DB_NAME")
if [[ RET -ne 0 ]]; then
echo "Cannot create database for owncloud"
exit RET
fi
if [ -f /initial_db.sql ]; then
echo "=> Loading initial database data to $DB_NAME"
RET=$(mysql -u$DB_USER -p$DB_PASS -h$DB_HOST -P$DB_PORT $DB_NAME < /initial_db.sql)
if [[ RET -ne 0 ]]; then
echo "Cannot load initial database data for owncloud"
exit RET
fi
fi
echo "=> Done!"
else
echo "=> Skipped creation of database $DB_NAME – it already exists."
fi
else
echo "Cannot connect to Mysql"
exit $DB_CONNECTABLE
fi
touch /.mysql_db_created
exec /run.sh
FROM michielbdejong/wordpress-subdir
......@@ -17,5 +17,5 @@ ENV DB_USER admin
ENV DB_PASS **ChangeMe**
EXPOSE 80
VOLUME ["/app/wp-content", "/app/.htaccess"]
VOLUME ["/app"]
CMD ["/run-wordpress.sh"]
# Usage:
PASS=`pwgen 20 1`
sudo docker pull debian:jessie
sudo docker build -t indiehosters/lamp ../lamp
sudo docker build -t indiehosters/wordpress .
sudo docker run -d -e MYSQL_PASS=$PASS --name mysql indiehosters/mysql
sudo docker run -d -p 80:80 --link mysql:db -e DB_PASS=$PASS indiehosters/wordpress
echo Using $PASS as the database password. Waiting for everything to be up...
sleep 20
curl -I http://localhost/
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