Several changes for public release.

This commit is contained in:
Jeroen Geusebroek 2016-01-29 14:13:24 +01:00
parent eb9f261070
commit c702822330
6 changed files with 56 additions and 28 deletions

2
.gitignore vendored
View File

@ -10,4 +10,4 @@
# Linux
*~
.directory
.Trash-*
.Trash-*

View File

@ -3,8 +3,8 @@ MAINTAINER Jeroen Geusebroek <me@jeroengeusebroek.nl>
ENV DEBIAN_FRONTEND="noninteractive" \
TERM="xterm" \
APTLIST="apache2 php5 php5-curl php5-gd php5-gmp php5-mysql git-core sudo cron" \
REFRESHED_AT='2015-01-18'
APTLIST="apache2 php5 php5-curl php5-gd php5-gmp php5-mysql git-core" \
REFRESHED_AT='2015-01-29'
RUN echo "force-unsafe-io" > /etc/dpkg/dpkg.cfg.d/02apt-speedup &&\
echo "Acquire::http {No-Cache=True;};" > /etc/apt/apt.conf.d/no-cache && \
@ -19,9 +19,8 @@ RUN echo "force-unsafe-io" > /etc/dpkg/dpkg.cfg.d/02apt-speedup &&\
rm -r /var/www/html && \
rm -rf /tmp/*
RUN git clone https://github.com/spotweb/spotweb.git /var/www/spotweb && \
cd /var/www/spotweb && \
git checkout media && \
RUN git clone -b media --single-branch https://github.com/spotweb/spotweb.git /var/www/spotweb && \
rm -rf /var/www/spotweb/.git && \
chmod -R 775 /var/www/spotweb && \
chown -R www-data:www-data /var/www/spotweb

View File

@ -1,11 +1,48 @@
# Docker spotweb
[![](https://badge.imagelayers.io/jgeusebroek/spotweb:latest.svg)](https://imagelayers.io/?images=jgeusebroek/spotweb:latest 'Get your own badge on imagelayers.io')
# Docker Spotweb image
An image running [ubuntu/15.10](https://github.com/gliderlabs/docker-alpine) Linux and [Spotweb](https://github.com/spotweb/spotweb) (media branch).
This image was mainly for own use, but it seems to be populair so I decided to provide some documentation.
## MySQL
You need a seperate MySQL / MariaDB server. This can be a ofcourse be a (linked) docker container but also a dedicated database server.
## Updates
The container will try to auto-update the database when a newer version image is released.
## Usage
docker run --restart=always -d -p 80:80 \
--hostname=spotweb \
--name=spotweb \
-v /config:/config \
-v <hostdir_where_config_will_persistently_be_stored>:/config \
-e TZ='Europe/Amsterdam'
-e SPOTWEB_DB_TYPE=pdo_mysql \
-e SPOTWEB_DB_HOST=<hostname> \
-e SPOTWEB_DB_HOST=<database_server_hostname> \
-e SPOTWEB_DB_NAME=spotweb \
-e SPOTWEB_DB_USER=spotweb \
-e SPOTWEB_DB_PASS=spotweb \
jgeusebroek/spotweb
jgeusebroek/spotweb
You should now be able to reach the spotweb interface on port 80, and you can configure Spotweb.
## Environment variables
* `TZ` The timezone the server is running in. Defaults to `Europe/Amsterdam`.
* `SPOTWEB_DB_TYPE` Database type. Use `pdo_mysql` for MySQL.
* `SPOTWEB_DB_HOST` The hostname / IP of the database server.
* `SPOTWEB_DB_NAME` The database used for spotweb.
* `SPOTWEB_DB_USER` The database server username.
* `SPOTWEB_DB_PASS` The database server password.
## License
MIT / BSD
## Author Information
[Jeroen Geusebroek](https://jeroengeusebroek.nl/)

View File

@ -1,2 +1,3 @@
#!/usr/bin/env bash
docker build --rm -t jgeusebroek/spotweb .
docker build --rm -t jgeusebroek/spotweb .

View File

@ -1,2 +1,3 @@
#!/usr/bin/env bash
docker build --rm --pull --no-cache -t jgeusebroek/spotweb .

View File

@ -1,16 +1,10 @@
#!/bin/bash
set -x
SPOTWEB_CRON=${SPOTWEB_CRON:-'*/15 * * * *'}
if [ ! -f /config/ownsettings.php ] && [ -f /var/www/spotweb/ownsettings.php ]; then
cp /var/www/spotweb/ownsettings.php /config/ownsettings.php
elif [ ! -f /config/ownsettings.php ] && [ ! -f /var/www/spotweb/ownsettings.php ]; then
touch /config/ownsettings.php
fi
chown www-data:www-data /config/ownsettings.php
touch /config/ownsettings.php && chown www-data:www-data /config/ownsettings.php
rm -f /var/www/spotweb/ownsettings.php
ln -s /config/ownsettings.php /var/www/spotweb/ownsettings.php
@ -32,18 +26,14 @@ if [ -f /config/dbsettings.inc.php ]; then
# Run database update
/usr/bin/php /var/www/spotweb/upgrade-db.php
else
echo "WARNING: You have no database configuration file, either create /config/dbsettings.inc.php or restart this container with the correct environment variables to auto generate the config."
echo -e "\nWARNING: You have no database configuration file, either create /config/dbsettings.inc.php or restart this container with the correct environment variables to auto generate the config.\n"
fi
echo "Updating PHP time zone"
TIMEZONE=${TIMEZONE:-"Europe/Amsterdam"}
sed -i "s#^;date.timezone =.*#date.timezone = ${TIMEZONE}#g" /etc/php5/*/php.ini
TZ=${TZ:-"Europe/Amsterdam"}
echo -e "Setting (PHP) time zone to ${TZ}\n"
sed -i "s#^;date.timezone =.*#date.timezone = ${TZ}#g" /etc/php5/*/php.ini
echo "Enabling PHP mod rewrite"
/usr/sbin/a2enmod rewrite
# Enabling PHP mod rewrite
/usr/sbin/a2enmod rewrite && /etc/init.d/apache2 restart
echo "Updating hourly cron"
(crontab -l ; echo "${SPOTWEB_CRON} /usr/bin/php /var/www/spotweb/retrieve.php | tee /var/log/spotweb-retrieve.log") | crontab -
/etc/init.d/apache2 restart
tail -F /var/log/apache2/*