Skip to content

Instantly share code, notes, and snippets.

@eliroca
Last active December 2, 2020 11:40
Show Gist options
  • Save eliroca/0ba2b33bdde950db0ecaf74f93349ee4 to your computer and use it in GitHub Desktop.
Save eliroca/0ba2b33bdde950db0ecaf74f93349ee4 to your computer and use it in GitHub Desktop.
MediaGoblin deployment on openSUSE

Deploy MediaGoblin

Due to locked dependencies in the project's setup.py, it only works on Leap 15.2 for now.

Install MediaGoblin and its requirements

For a production deployment, you’ll also need Nginx as frontend web server and RabbitMQ to store the media processing queue, as well as PostgreSQL as database. Since I've failed to configure PostgreSQL, it's not covered in this document. Nginx configuration will be added soon™.

sudo zypper addrepo https://download.opensuse.org/repositories/home:/eroca/openSUSE_Leap_15.2/home:eroca.repo
sudo zypper --gpg-auto-import-keys refresh
sudo zypper install mediagoblin

The following 172 NEW packages are going to be installed:
  erlang erlang-epmd gstreamer gstreamer-lang gstreamer-plugins-base gstreamer-plugins-base-lang insserv-compat libcdda_interface0 libcdda_paranoia0 libgbm1
  libgd3 libgraphene-1_0-0 libgstallocators-1_0-0 libgstapp-1_0-0 libgstaudio-1_0-0 libgstgl-1_0-0 libgstpbutils-1_0-0 libgstreamer-1_0-0 libgstriff-1_0-0
  libgsttag-1_0-0 libgstvideo-1_0-0 libgudev-1_0-0 libhiredis0_13 libLLVM9 libltdl7 libmaxminddb0 libmemcached11 libogg0 libopus0 liborc-0_4-0
  libpackagekit-glib2-18 libpq5 libtheoradec1 libtheoraenc1 libunwind libvisual libvorbis0 libvorbisenc2 libwayland-client0 libwayland-egl1 libwayland-server0
  libwebp7 libwebpdemux2 libwebpmux3 libX11-xcb1 libxslt1 libXv1 mediagoblin memcached nginx PackageKit PackageKit-backend-zypp PackageKit-branding-openSUSE
  PackageKit-gstreamer-plugin PackageKit-lang postgresql postgresql12 postgresql12-llvmjit postgresql12-server postgresql-llvmjit postgresql-server psqlODBC
  python3-alabaster python3-alembic python3-amqp python3-apipkg python3-argh python3-argon2-cffi python3-asn1crypto python3-atomicwrites python3-attrs
  python3-Babel python3-bcrypt python3-Beaker python3-beautifulsoup4 python3-billiard python3-blinker python3-Brotli python3-celery python3-certifi
  python3-cffi python3-chardet python3-cryptography python3-cssselect python3-Django python3-dnspython python3-docutils python3-ecdsa python3-email-validator
  python3-execnet python3-ExifRead python3-geoip2 python3-hiredis python3-idna python3-imagesize python3-importlib-metadata python3-itsdangerous
  python3-Jinja2 python3-jsonschema python3-kombu python3-lxml python3-Mako python3-Markdown python3-MarkupSafe python3-maxminddb python3-more-itertools
  python3-ndg-httpsclient python3-oauthlib python3-olefile python3-Paste python3-PasteDeploy python3-PasteScript python3-pathtools python3-Pillow
  python3-pluggy python3-psycopg2 python3-py python3-pyasn1 python3-pycparser python3-pycryptodome python3-Pygments python3-PyJWT python3-pyLD python3-pylibmc
  python3-pymongo python3-pyOpenSSL python3-PySocks python3-pytest5 python3-pytest-forked python3-pytest-xdist python3-python-dateutil python3-python-editor
  python3-python-memcached python3-pytz python3-PyYAML python3-redis python3-requests python3-snowballstemmer python3-soupsieve python3-Sphinx
  python3-sphinxcontrib python3-sphinxcontrib-websupport python3-Sphinx-doc-man python3-sphinx_rtd_theme python3-SQLAlchemy python3-sqlalchemy-migrate
  python3-sqlparse python3-Tempita python3-termcolor python3-Unidecode python3-urllib3 python3-vine python3-waitress python3-watchdog python3-wcwidth
  python3-WebOb python3-WebTest python3-Werkzeug python3-Whoosh python3-WTForms python3-zipp python-Sphinx-doc-man-common rabbitmq-server redis socat
  typelib-1_0-Gst-1_0 typelib-1_0-GstAudio-1_0 typelib-1_0-GstPbutils-1_0 typelib-1_0-GstTag-1_0 typelib-1_0-GstVideo-1_0 unixODBC vim-plugin-nginx

The following 39 recommended packages were automatically selected:
  gstreamer-lang nginx PackageKit PackageKit-gstreamer-plugin postgresql12 postgresql12-llvmjit postgresql12-server postgresql-server psqlODBC
  python3-argon2-cffi python3-Babel python3-bcrypt python3-Beaker python3-Brotli python3-cryptography python3-Django python3-ecdsa python3-geoip2
  python3-hiredis python3-idna python3-Jinja2 python3-ndg-httpsclient python3-psycopg2 python3-pycryptodome python3-pylibmc python3-pymongo python3-pyOpenSSL
  python3-PySocks python3-python-dateutil python3-python-memcached python3-PyYAML python3-redis python3-Sphinx python3-Sphinx-doc-man python3-SQLAlchemy
  python3-termcolor python3-watchdog python3-Whoosh vim-plugin-nginx

172 new packages to install.
Overall download size: 140,8 MiB. Already cached: 0 B. After the operation, additional 453,2 MiB will be used.

Configure MediaGoblin

RabbitMQ configuration:

https://docs.celeryproject.org/en/stable/getting-started/brokers/rabbitmq.html

sudo systemctl start rabbitmq-server.service
sudo systemctl enable rabbitmq-server.service

sudo rabbitmqctl add_user myuser mypassword

sudo rabbitmqctl add_vhost myvhost
sudo rabbitmqctl set_user_tags myuser mytag
sudo rabbitmqctl set_permissions -p myvhost myuser ".*" ".*" ".*"

Switch to mediagoblin user:

sudo su mediagoblin --shell=/bin/bash
cd /usr/share/mediagoblin

Add to the [celery] section in your mediagoblin[_local].ini the following line:

broker_url = 'amqp://myuser:mypassword@localhost:5672/myvhost'

If you are using PostgreSQL, edit the [mediagoblin] section in your mediagoblin[_local].ini:

Note: this implies that you have a database and a user named mediagoblin in PostgreSQL.

Remove the # prefix on the line containing: sql_engine = postgresql:///mediagoblin

Initialize the database and create an administrator user:

Note: these commands need to be run in /usr/share/mediagoblin directory as mediagoblin user.

gmg dbupdate

gmg adduser -u admin -p admin -e eli@local.com
gmg makeadmin admin

Final step:

sudo systemctl enable mediagoblin.service mediagoblin-celeryd.service mediagoblin-paster.service
sudo systemctl restart mediagoblin.service mediagoblin-celeryd.service mediagoblin-paster.service

Open localhost:6543 and see it running.

Be sure to check the logs at /var/log/mediagoblin if you encounter problems.

Upstream documentation: https://mediagoblin.readthedocs.io/en/stable/siteadmin/deploying.html

Improvements are welcome

If you have any ideas on improving either this document or the deployment itself, feel free to contact me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment