Repository

From Anarchaserver
Revision as of 21:00, 2 September 2017 by B01 (talk | contribs)

Container repository : Mediagoblin for images, sounds and vidéo

Installation of Mediagoblin

Connect to the container :

sudo lxc-attach -n repository

Installation of the dependencies

On debian Strech, nmp doesn't seem to be in the repository, so to install (http://linuxbsdos.com/2017/06/26/how-to-install-node-js-lts-on-debian-9-stretch/) :

apt install curl
curl -sL https://deb.nodesource.com/setup_6.x | bash -
apt install nodejs
node --version
              v6.11.2
apt install build-essential libssl-dev
npm version

Puis on installe les dépendances :

 apt-get install git-core python python-dev python-lxml python-imaging python-virtualenv automake nginx

Installation of Postgresql

apt-get install postgresql postgresql-client python-psycopg2

Configure Postgresql

loggin as postgresql

su - postgres

the as postgresql user :

createuser -A -D mediagoblin
createdb -E UNICODE -O mediagoblin mediagoblin
exit

Now, as root, create a mediagoblin user

useradd -c "GNU MediaGoblin system account" -d /var/lib/mediagoblin -m -r -g www-data mediagoblin
groupadd mediagoblin && sudo usermod --append -G mediagoblin mediagoblin

Create a mediagobling directory and install it in a virtual env

mkdir -p /srv/repository.anarchaserver.org && chown -hR mediagoblin:www-data /srv/&& chown -hR mediagoblin:www-data /srv/repository.anarchaserver.org
su mediagoblin -s /bin/bash
cd /srv/repository.anarchaserver.org/
git clone git://git.savannah.gnu.org/mediagoblin.git -b stable
cd mediagoblin/
git submodule init && git submodule update

Set up the hacking env

./bootstrap.sh && ./configure && make
mkdir user_dev && chmod 750 user_dev
./bin/easy_install flup==1.0.3.dev-20110405

This concludes the initial configuration of the MediaGoblin environment. In the future, when you update your codebase, you should also run:

$ git submodule update && ./bin/python setup.py develop --upgrade && ./bin/gmg dbupdate

Note: If you are running an active site, depending on your server configuration, you may need to stop it first or the dbupdate command may hang (and it’s certainly a good idea to restart it after the update)

Deploy MediaGoblin Services

cp -av mediagoblin.ini mediagoblin_local.ini && cp -av paste.ini paste_local.ini

Then edit 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.
  • Uncomment sql_engine = postgresql:///mediagoblin

it gives :

[mediagoblin]
#direct_remote_path = /mediagoblin/
direct_remote_path = /mgoblin_static/
email_sender_address = "anarchaserver@autistiche.org"
## Uncomment and change to your DB's appropiate setting.
## Default is a local sqlite db "mediagoblin.db".
## Don't forget to run `./bin/gmg dbupdate` after having changed it.
sql_engine = postgresql:///mediagoblin
...
# Place plugins here, each in their own subsection of [plugins].
# See http://docs.mediagoblin.org/siteadmin/plugins.html for details.
[plugins]
mediagoblin.plugins.geolocation
mediagoblin.plugins.basic_auth
mediagoblin.plugins.processing_info
mediagoblin.media_types.image
mediagoblin.media_types.video
mediagoblin.media_types.audio

Before you start using the database, you need to run:

./bin/gmg dbupdate

Add Audio and video support in mediagoblin

Video

apt-get install python-gi python3-gi gstreamer1.0-tools gir1.2-gstreamer-1.0 gir1.2-gst-plugins-base-1.0 gstreamer1.0-plugins-good gstreamer1.0-plugins-ugly gstreamer1.0-plugins-bad gstreamer1.0-libav python-gst-1.0

And add the mediagoblin.media_types.video in mediagoblin_local.ini as below

Audio

apt-get install python-gst-1.0 gstreamer1.0-plugins-{base,bad,good,ugly} gstreamer1.0-libav python-numpy python-scipy libsndfile1-dev libasound2-dev

And add the mediagoblin.media_types.audio in mediagoblin_local.ini as below

Update the database to include video and audio

in /srv/repository.anarchaserver.org/mediagoblin/ as mediagoblin user :

./bin/gmg dbupdate

=== Configure N GINX and FastCGI ===

nano /srv/repository.anarchaserver.org/nginx.conf

see the example file : http://mediagoblin.readthedocs.io/en/stable/siteadmin/deploying.html#fastcgi-and-nginx

Create a symlink :

ln -s /srv/repository.anarchaserver.org/nginx.conf /etc/nginx/sites-enabled/

Restart NGINX

systemctl restart nginx

Start the server

cd /srv/repository.anarchaserver.org/mediagoblin/
su mediagoblin -s /bin/bash
./lazyserver.sh --server-name=fcgi fcgi_host=127.0.0.1 fcgi_port=26543