Repository

From Anarchaserver

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

Manual update of piwigo

To do a manual update once connected to the repository container :

  1. Put the gallery in maintenance mode in the admin backoffice
  2. Execute the following operations to make a backup and update
mysqldump -u piwigouser -p piwigo > piwigobackup26072020.sql
wget https://www.piwigo.org/download/dlcounter.php?code=latest
mv dlcounter.php\?code\=latest piwigo-2.10.2.zip
unzip piwigo-2.10.2.zip 
tar -czvf piwigohtmlfolderbackup26072020.tar.gz /var/www/html/
cp -Ru piwigo/ /var/www/html/
  1. Then go to https://repository.anarchaserver.org/upgrade.php
  2. Update the plug-ins threw the backoffice
  3. Reactivate the theme and put it as default : Bootstrap Darkroom (default)
  4. Check if everything is ok
  5. unlock the maintenance mode

more infos on https://www.piwigo.org/guides/update/manual

Upload big (video) files to piwigo

For big files (> 500 Mo ?), it is not possible to upload file from the web interface, so to add bigger files in the repository, here is what should be done :

  • Transfer with ssh (scp) or ftp the file to the server
  • Create a new folder in /var/www/html/galleries/ like mkdir /var/www/html/galleries/perfo
  • Move the big file to /var/www/html/galleries/perfo/
  • Adapt the permissions of the folder and file :
chmod 755 /var/www/html/galleries/perfo/
chmod 644 /var/www/html/galleries/perfo/bigfile.mp4
chown -R www-data: /var/www/html/galleries/perfo/
  • Then threw Piwigo web interface, go as an admin to Tools > Synchronise to integrate the file into the database
  • Then go to Plugin > VideoJS > Synchronise to create the thumbnail and more

Now the video should appear !