Mediagoblin

From ParabolaWiki
Jump to: navigation, search

"GNU MediaGoblin is a free, decentralized Web application for hosting and sharing many forms of digital media. It strives to provide an extensible, federated, and freedom-respectful software replacement to major media publishing services such as Flickr, DeviantArt, and YouTube." From Wikipedia.

Native functionality and plugins exist for images, videos, sound, ASCII art, PDF, ODF, and even 3D models.

Federation support isn't finished as of version 0.9.0, but is said to be arriving for 1.0. Stay tuned and cross your fingers.

1 Install

Install mediagoblin from the [pcr] repo. Pay attention to optional dependencies, as they are needed to enable video support and be able to use the PostgreSQL backend.

# pacman -S mediagoblin

2 Configure

Configuration is occurs inside /etc/webapps/mediagoblin/. A few basic properties must be set before MediaGoblin will work:

In mediagoblin_local.ini:

  • Set email_sender_address to the address you wish to be used as the sender for system-generated emails.
  • Edit direct_remote_path, base_dir, and base_url if your mediagoblin directory is not the root directory of your vhost.

In paste_local.ini

  • Set host and port under the [server:main] section. By default Mediagoblin will listen to local requests on port 6543.

2.1 Account management

This is how you disable open registration in /etc/webapps/mediagoblin/mediagoblin_local.ini:

/etc/webapps/mediagoblin/mediagoblin_local.ini
[mediagoblin]
allow_registration = false

You can still make accounts for people you know and trust via the /usr/share/webapps/mediagoblin/bin/gmg adduser command:

# su -c '/usr/share/webapps/mediagoblin/bin/gmg adduser -u <user> -p <password> -e <email>' - mediagoblin

gmg makeadmin and gmg changepw in turn grant administrative privileges and change passwords.

Alternatively, use one of the available CAPTCHA plugins.

2.2 Session security

Warning: The directory /var/lib/mediagoblin/crypto/ contains some very sensitive files; especially itsdangeroussecret.bin. It's very important for session security. Make sure not to leak its contents anywhere. If the contents gets leaked nevertheless, delete your file and restart the server, so that it creates a new secret key. All previous sessions will be invalidated.

2.3 PostgreSQL

MediaGoblin currently supports PostgreSQL and SQLite. The default is a local SQLite database. This will “just work” for small deployments. For medium to large deployments we recommend PostgreSQL. If you don’t want/need postgres, skip this section.

# pacman -S --needed --asdeps postgresql python-psycopg2
Note: We will assume postgres is now running. Refer to PostgreSQL to familiarize yourself with it.

The installation process will create a new system user named postgres, which will have privilegies sufficient to manage the database. We will create a new database user with restricted privilegies and a new database owned by our restricted database user for our MediaGoblin instance.

In this example, the database user will be mediagoblin and the database name will be mediagoblin too.

We’ll add these entities by first switching to the postgres account:

# su - postgres

This will change your prompt and environment to postgres'. Enter the following createuser and createdb commands at that prompt. We’ll create the mediagoblin database user first:

[postgres $] createuser -A -D mediagoblin

Then we’ll create an empty database where all of our MediaGoblin data will be stored:

[postgres $] createdb -E UNICODE -O mediagoblin mediagoblin

Exit.

Note: Where is the password? These steps only enabled you to authenticate to postgres in a password-less manner via local UNIX authentication.

Edit the [mediagoblin] section in your /etc/webapps/mediagoblin/mediagoblin_local.ini and put in:

/etc/webapps/mediagoblin/mediagoblin_local.ini
[mediagoblin]
sql_engine = postgresql:///mediagoblin

Before you start using the database, you need to populate it with the basic Mediagoblin schema. Run gmg dbupdate as the mediagoblin user. E.g:

# su -c '/usr/share/webapps/mediagoblin/bin/gmg dbupdate' - mediagoblin

2.4 FastCGI with Nginx

Warning: FastCGI is currently broken

By default Mediagoblin runs a standalone WSGI/Paste server. We will explain with a configuration example how to tell Nginx to talk to Mediagoblin via FastCGI, however, you may use any webserver of your choice as long as it supports the FastCGI protocol. (See the next subsection, #Other servers).

You may also skip this section entirely and continue to activate the standalone server. That will be good enough for small installations.


2.4.1 Other servers

Instructions and scripts for running MediaGoblin on Apache and other servers can be found on the MediaGoblin wiki.

3 Run

Note: This assumes Systemd

Enable and start the paster and celery services:

# systemctl enable --now mediagoblin-paster.service mediagoblin-celeryd.service

Celery is a separate process in communication with the standalone Paste web server. Celery offloads the latter by doing all the heavy-lifting in the background, such as media processing, allowing for a smoother user experience.

4 Acknowledgment

This article contains information from the official Mediagoblin 0.9.0 documentation, which was released to the public domain via CC0.