Difference between revisions of "Repository"

From Anarchaserver
(4 intermediate revisions by the same user not shown)
Line 2: Line 2:
== vhost config on the host server ==
== vhost config on the host server ==
repository.conf
repository.conf
<code>
 
<VirtualHost *:80>
<VirtualHost *:80>
         ServerAdmin webmaster@localhost
         ServerAdmin webmaster@localhost
         ServerName repository.anarchaserver.org
         ServerName repository.anarchaserver.org
Line 25: Line 25:




RewriteEngine on
RewriteEngine on
RewriteCond %{SERVER_NAME} =repository.anarchaserver.org
RewriteCond %{SERVER_NAME} =repository.anarchaserver.org
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,QSA,R=permanent]
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,QSA,R=permanent]
</VirtualHost>
</VirtualHost>
</code>
 
repository-le-ssl.conf
repository-le-ssl.conf
<code>
 
<IfModule mod_ssl.c>
<IfModule mod_ssl.c>
<VirtualHost *:443>
<VirtualHost *:443>
         ServerAdmin webmaster@localhost
         ServerAdmin webmaster@localhost
         ServerName repository.anarchaserver.org
         ServerName repository.anarchaserver.org
Line 60: Line 60:




#RewriteEngine on
#RewriteEngine on
SSLCertificateFile /etc/letsencrypt/live/repository.anarchaserver.org/fullchain.pem
SSLCertificateFile /etc/letsencrypt/live/repository.anarchaserver.org/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/repository.anarchaserver.org/privkey.pem
SSLCertificateKeyFile /etc/letsencrypt/live/repository.anarchaserver.org/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</VirtualHost>
</IfModule>


</IfModule>
</code>
== Installation of Piwigo ==
== Installation of Piwigo ==
* https://piwigo.org/get-started
* https://piwigo.org/get-started
Line 86: Line 85:
  systemctl restart apache2
  systemctl restart apache2
* Finish the configuration : go to :
* Finish the configuration : go to :
  https://repository.anarchaserver.org  
  https://repository.anarchaserver.org
[[File:Piwigoconfig.png]]
 
== Installation of Videojs Plug in to allow upload of sound and video ==
* https://piwigo.org/ext/extension_view.php?eid=610
* https://github.com/xbgmsharp/piwigo-videojs
* Documentation wiki https://github.com/xbgmsharp/piwigo-videojs/wiki
To install, activate the File Editor plug-in and follow the instructions here https://github.com/xbgmsharp/piwigo-videojs/wiki/How-to-add-videos
 
Also mediainfo version does'nt work, you have to replace it by this one https://mediaarea.net/en/MediaInfo/Download/Debian
* Download the 3 packages and :
sudo dpkg -i *deb"
If you get an error message, use:
sudo apt-get -f install
 
On Debian Stretch, there is a few problem with PHP7 : have to comment a break function in a php file line 185
 
 
=== Batch upload and synchronisation ===
There is the possibility to transfer files to a new folder in the galleries folder of piwigo on the server and the synchronise the database so as to include those files.
 
It can be useful if you want to archive a whole vimeo channel on piwigo, with a ssh shell on the server, you can download the channel with http://rg3.github.io/youtube-dl/
 
You have to synchronise the folder and the database with this panel :
 
[[File:Piwigo-synchro.png|900px]]
 
 
----
 


= Deprecated > Piwigo instead of Mediagoblin =
= Deprecated > Piwigo instead of Mediagoblin =

Revision as of 17:11, 7 October 2018

Container repository : Piwigo for images, sounds and video

vhost config on the host server

repository.conf

<VirtualHost *:80>
       ServerAdmin webmaster@localhost
       ServerName repository.anarchaserver.org


       ErrorLog ${APACHE_LOG_DIR}/repository-error.log
       CustomLog ${APACHE_LOG_DIR}/repository-access.log combined


       ProxyPreserveHost       On
       ProxyRequests           Off
       ProxyPass / http://10.0.3.4/
       ProxyPassReverse http://10.0.3.4/ /


       <Proxy *>
               Order deny,allow
               Allow from all
       </Proxy>


RewriteEngine on
RewriteCond %{SERVER_NAME} =repository.anarchaserver.org
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,QSA,R=permanent]
</VirtualHost>

repository-le-ssl.conf

<IfModule mod_ssl.c>
<VirtualHost *:443>
       ServerAdmin webmaster@localhost
       ServerName repository.anarchaserver.org


       ErrorLog ${APACHE_LOG_DIR}/repository-error.log
       CustomLog ${APACHE_LOG_DIR}/repository-access.log combined
       ProxyPreserveHost       On
       ProxyRequests           Off
       ProxyPass / https://repository.anarchaserver.org/
       ProxyPassReverse / https://repository.anarchaserver.org/
       <Proxy *>
               Order deny,allow
               Allow from all
       </Proxy>
       SSLEngine on
       SSLProxyEngine On
       SSLProxyVerify none
       SSLProxyCheckPeerCN off
       SSLProxyCheckPeerName off
       SSLProxyCheckPeerExpire off


#RewriteEngine on
SSLCertificateFile /etc/letsencrypt/live/repository.anarchaserver.org/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/repository.anarchaserver.org/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>

Installation of Piwigo

sudo apt install iputils-ping nano apache2 php-xml php-mbstring mysql-server php7.0 php7.0-gd imagemagick exiftool wget unzip php7.0-mysql apt-utils locate
  • Get Piwigo
cd /tmp
wget https://piwigo.org/download/dlcounter.php?code=latest
unzip dlcounter.php\?code\=latest 
unzip /tmp/dlcounter.php\?code\=latest  .
mv piwigo/* /var/www/html/
  • Create a mysql user
mysql -u root
  • Activate ssl on the container
a2enmod ssl
ln -s /etc/apache2/sites-available/default-ssl.conf /etc/apache2/sites-enable/default-ssl.conf
systemctl restart apache2
  • Finish the configuration : go to :
https://repository.anarchaserver.org

Piwigoconfig.png

Installation of Videojs Plug in to allow upload of sound and video

To install, activate the File Editor plug-in and follow the instructions here https://github.com/xbgmsharp/piwigo-videojs/wiki/How-to-add-videos

Also mediainfo version does'nt work, you have to replace it by this one https://mediaarea.net/en/MediaInfo/Download/Debian

  • Download the 3 packages and :
sudo dpkg -i *deb"

If you get an error message, use:

sudo apt-get -f install

On Debian Stretch, there is a few problem with PHP7 : have to comment a break function in a php file line 185


Batch upload and synchronisation

There is the possibility to transfer files to a new folder in the galleries folder of piwigo on the server and the synchronise the database so as to include those files.

It can be useful if you want to archive a whole vimeo channel on piwigo, with a ssh shell on the server, you can download the channel with http://rg3.github.io/youtube-dl/

You have to synchronise the folder and the database with this panel :

Piwigo-synchro.png




Deprecated > Piwigo instead of Mediagoblin

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