Add Python 3 docker-compose recipe for MediaGoblin hacking.

This commit is contained in:
Ben Sturmfels 2019-09-16 18:08:57 +10:00
parent c3096e30d5
commit 8096beab5c
No known key found for this signature in database
GPG Key ID: 023C05E2C9C068F0
3 changed files with 45 additions and 0 deletions

3
.dockerignore Normal file
View File

@ -0,0 +1,3 @@
# This helps to reduce the size of the Docker build context.
user_dev
node_modules

33
docker-compose.yml Normal file
View File

@ -0,0 +1,33 @@
# A docker-compose recipe for MediaGoblin hacking.
#
# Tested on Trisquel 8. Currently runs Python 3 and works for photos and video.
# Audio raises an exception "NameError: name 'audiolab' is not defined".
# docker-compose up --build
# docker-compose run --rm web bin/python
# docker-compose start [service]
# docker-compose stop [service]
# docker-compose down
version: '2'
services:
web:
build:
context: .
dockerfile: Dockerfile-python3
# Is user required here, or does it just pick up from the last USER in Dockerfile?
user: www-data
# Consider running dbupdate here (at runtime), rather than in Dockerfile.
command: ./lazyserver.sh --server-name=broadcast
volumes:
# Mount your local copy of the source for hecking on MediaGoblin.
- ./mediagoblin:/opt/mediagoblin/mediagoblin
# Mount your local media/secrets. Requires some initial setup:
#
# $ mkdir user_dev/media user_dev/crypto
# $ chmod 777 user_dev/media user_dev_crypto
- ./user_dev:/opt/mediagoblin/user_dev
ports:
- "6543:6543"

View File

@ -84,6 +84,15 @@ def read_mediagoblin_config(config_path, config_spec_path=CONFIG_SPEC_PATH):
config_spec_path, config_spec_path,
encoding="UTF8", list_values=False, _inspec=True) encoding="UTF8", list_values=False, _inspec=True)
# HACK to get MediaGoblin running under Docker/Python 3. Without this line,
# `./bin/gmg dbupdate` fails as the configuration under 'DEFAULT' in
# config_spec still had %(here)s markers in it, when these should have been
# replaced with actual paths, resulting in
# "configobj.MissingInterpolationOption: missing option "here" in
# interpolation". This issue doesn't seem to appear when running on Guix,
# but adding this line also doesn't appear to cause problems on Guix.
_setup_defaults(config_spec, config_path)
# Set up extra defaults that will be pushed into the rest of the # Set up extra defaults that will be pushed into the rest of the
# configs. This is a combined extrapolation of defaults based on # configs. This is a combined extrapolation of defaults based on
mainconfig_defaults = copy.copy(config_spec.get("DEFAULT", {})) mainconfig_defaults = copy.copy(config_spec.get("DEFAULT", {}))