Commit d7d9dfa5 authored by Michiel de Jong's avatar Michiel de Jong
parent e66e04ee
# Start off at Ubuntu 13.04
from debian:jessie
# based on
# Install needed OS packages
run apt-get update
run apt-get install --force-yes -y git-core python python-dev python-lxml python-imaging python-virtualenv python-psycopg2 build-essential postgresql postgresql-client sudo supervisor openssh-server
# Make a home for mediagoblin
run mkdir /srv/mediagoblin
# Setup the environment: clone the mediagoblin repo, install python packages
add ./ /srv/mediagoblin/
run bash -c "cd /srv/mediagoblin; chmod +x"
run bash -c "cd /srv/mediagoblin; ./"
# Patch the email code so that test emails are logged
#add ./email_logging.patch /srv/mediagoblin/email_logging.patch
#run bash -c "cd /srv/mediagoblin/mediagoblin; patch -p0 < ../email_logging.patch"
# Set up the mediagoblin database in postgresql
add ./ /srv/mediagoblin/
run bash -c "cd /srv/mediagoblin; chmod +x"
run bash -c "cd /srv/mediagoblin; ./"
# Configure the database connection and create the initial tables
add ./mediagoblin_local.ini /srv/mediagoblin/mediagoblin/mediagoblin_local.ini
add ./ /srv/mediagoblin/
run bash -c "cd /srv/mediagoblin; chmod +x"
run bash -c "cd /srv/mediagoblin; cd mediagoblin; ../"
# Insert the script to run mediagoblin
add ./ /srv/mediagoblin/
run bash -c "cd /srv/mediagoblin; chmod +x"
# Create a couple of required directories
run mkdir -p /var/run/sshd
run mkdir -p /var/log/supervisor
run locale-gen en_US en_US.UTF-8
# Configure supervisord
add ./supervisord.conf /etc/supervisor/conf.d/supervisord.conf
# Expose the ports and set the command to run
expose 22
expose 6543
cmd ["/usr/bin/supervisord", "-n"]
# Getting the container
## Pull
$ docker pull mtnate/mediagoblin
## Build
$ docker build -t mediagoblin .
Uploading context 20480 bytes
Step 1 : FROM lopter/raring-base:latest
---> 52dbc0e3cd5a
... snip ...
Step 24 : CMD ["/usr/bin/supervisord", "-n"]
---> Running in 0d1c055df130
---> b10ed0e5267c
Successfully built b10ed0e5267c
$ docker images
lopter/raring-base latest 52dbc0e3cd5a 7 weeks ago 186.4 MB (virtual 347.9 MB)
mediagoblin latest b10ed0e5267c 2 minutes ago 12.29 kB (virtual 1.029 GB)
# Running the container
Start the container:
$ docker run -d mtnate/mediagoblin
The web port is whatever docker maps to port 6543:
$ docker port da42702ecbb9 6543
Access the web port in a browser and click on `Create an account at this site`. After filling out the information, there will be a message about the email verification being printed on the server.
To see the link (root password is `secret`):
$ ssh root@localhost -p `docker port da42702ecbb9 22` tail -f /var/log/supervisor/mediagoblin.log
The authenticity of host '[localhost]:49157 ([]:49157)' can't be established.
ECDSA key fingerprint is a6:32:d3:b0:1b:a0:2e:dc:62:9e:f6:04:a5:96:df:20.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '[localhost]:49157' (ECDSA) to the list of known hosts.
root@localhost's password:
2013-07-23 21:43:29,150 INFO [] From address:
2013-07-23 21:43:29,150 INFO [] To addresses:
2013-07-23 21:43:29,150 INFO [] Subject: GNU MediaGoblin - Verify your email!
2013-07-23 21:43:29,150 INFO [] -- Body: --
2013-07-23 21:43:29,150 INFO [] Hi testtest,
to activate your GNU MediaGoblin account, open the following URL in
your web browser:
# die on any error
set -e
set -x
# start up postgres
/etc/init.d/postgresql start
sleep 2;
# create root user
sudo -u postgres createuser root -R -S -D
# create root db
sudo -u postgres createdb root
# die on any error
set -e
set -x
# start up postgres
/etc/init.d/postgresql start
sleep 2;
# load up virtualenv
. bin/activate
# update the database
./bin/gmg dbupdate
diff --git mediagoblin/tools/ mediagoblin/tools/
index 0fabc5a..2dbea47 100644
--- mediagoblin/tools/
+++ mediagoblin/tools/
@@ -15,6 +15,7 @@
# along with this program. If not, see <>.
import smtplib
+import logging
from email.MIMEText import MIMEText
from mediagoblin import mg_globals, messages
from import common
@@ -23,6 +24,8 @@ from import common
### Special email test stuff begins HERE
### ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+_log = logging.getLogger(__name__)
# We have two "test inboxes" here:
@@ -119,12 +122,12 @@ def send_email(from_addr, to_addrs, subject, message_body):
elif mg_globals.app_config['email_debug_mode']:
- print u"===== Email ====="
- print u"From address: %s" % message['From']
- print u"To addresses: %s" % message['To']
- print u"Subject: %s" % message['Subject']
- print u"-- Body: --"
- print message.get_payload(decode=True)
+"===== Email =====")
+"From address: %s" % message['From'])
+"To addresses: %s" % message['To'])
+"Subject: %s" % message['Subject'])
+"-- Body: --")
return mhost.sendmail(from_addr, to_addrs, message.as_string())
# die on any error
set -e
# clone repo
git clone git://
cd mediagoblin
git submodule update --init
# set up the deps and main code
(virtualenv --system-site-packages . || virtualenv .) && ./bin/python develop
# install flup for fcgi
./bin/easy_install flup
direct_remote_path = /mgoblin_static/
email_sender_address = ""
sql_engine = postgresql:///root
email_debug_mode = true
allow_registration = true
base_dir = %(here)s/user_dev/media/queue
base_dir = %(here)s/user_dev/media/public
base_url = /mgoblin_media/
cd /srv/mediagoblin/mediagoblin
. bin/activate
./ --server-name=broadcast
command=sudo -u postgres /usr/lib/postgresql/9.1/bin/postgres -D /var/lib/postgresql/9.1/main -c config_file=/etc/postgresql/9.1/main/postgresql.conf
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