Difference between revisions of "Repository"

From Anarchaserver
 
(9 intermediate revisions by the same user not shown)
Line 1: Line 1:
= Container repository : Mediagoblin for images, sounds and vidéo =
= Container repository : Piwigo for images, sounds and video =
== Installation of Mediagoblin ==
== vhost config on the host server ==
Connect to the container :
repository.conf
sudo lxc-attach -n repository


=== Installation of the dependencies ===
<VirtualHost *:80>
* Main doc : http://mediagoblin.readthedocs.io/en/stable/siteadmin/deploying.html
        ServerAdmin webmaster@localhost
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/) :
        ServerName repository.anarchaserver.org
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 ===
        ErrorLog ${APACHE_LOG_DIR}/repository-error.log
mkdir -p /srv/repository.anarchaserver.org && chown -hR mediagoblin:www-data /srv/&& chown -hR mediagoblin:www-data /srv/repository.anarchaserver.org
        CustomLog ${APACHE_LOG_DIR}/repository-access.log combined


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:
        ProxyPreserveHost      On
        ProxyRequests          Off


$ git submodule update && ./bin/python setup.py develop --upgrade && ./bin/gmg dbupdate
        ProxyPass / http://10.0.3.4/
        ProxyPassReverse http://10.0.3.4/ /


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 ===
        <Proxy *>
cp -av mediagoblin.ini mediagoblin_local.ini && cp -av paste.ini paste_local.ini
                Order deny,allow
                Allow from all
        </Proxy>


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 :
<code>
[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.
  RewriteEngine on
  ## Default is a local sqlite db "mediagoblin.db".
  RewriteCond %{SERVER_NAME} =repository.anarchaserver.org
  ## Don't forget to run `./bin/gmg dbupdate` after having changed it.
  RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,QSA,R=permanent]
sql_engine = postgresql:///mediagoblin
  </VirtualHost>
  ...
</code>
Before you start using the database, you need to run:
./bin/gmg dbupdate


=== Configure NGINX and FastCGI ===
repository-le-ssl.conf
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 :
<IfModule mod_ssl.c>
ln -s /srv/repository.anarchaserver.org/nginx.conf /etc/nginx/sites-enabled/
<VirtualHost *:443>
Restart NGINX
        ServerAdmin webmaster@localhost
systemctl restart nginx
        ServerName repository.anarchaserver.org


=== Start the server ===
 
  cd /srv/repository.anarchaserver.org/mediagoblin/
        ErrorLog ${APACHE_LOG_DIR}/repository-error.log
su mediagoblin -s /bin/bash
        CustomLog ${APACHE_LOG_DIR}/repository-access.log combined
  ./lazyserver.sh --server-name=fcgi fcgi_host=127.0.0.1 fcgi_port=26543
 
        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 ==
* https://piwigo.org/get-started
** Requirements https://piwigo.org/doc/doku.php?id=user_documentation:learn:install:before
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
[[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]]
 
== Manual update of piwigo ==
To do a manual update once connected to the repository container :
 
# Put the gallery in maintenance mode in the admin backoffice
# 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/
# Then go to https://repository.anarchaserver.org/upgrade.php
# Update the plug-ins threw the backoffice
# Reactivate the theme and put it as default : Bootstrap Darkroom (default)
# Check if everything is ok
# 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 !
 
 
 
 
----

Latest revision as of 23:32, 28 December 2020

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 !