User Tools

Site Tools


servers:linux:nginx:piwigo

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
servers:linux:nginx:piwigo [2025/09/11 07:17] Sean Rhoneservers:linux:nginx:piwigo [2025/10/16 23:22] (current) – [Database] Sean Rhone
Line 37: Line 37:
   * https://github.com/Piwigo/piwigo-bootstrap-darkroom/commits/master/   * https://github.com/Piwigo/piwigo-bootstrap-darkroom/commits/master/
  
-  sudo git clone --branch 'master' --depth '1' --recurse-submodules 'https://github.com/Piwigo/Piwigo.git' '/srv/www/media' && sudo chown -R 'wwwrun':'www' '/srv/www/media'+  sudo git clone --branch 'master' --depth '1' --recurse-submodules 'https://github.com/Piwigo/Piwigo.git' '/srv/www/media' && sudo chown -R 'wwwrun':'www' '/srv/www/media' && sudo chmod -R '0755' '/srv/www/media'
  
-  sudo git clone --branch 'master' --depth '1' --recurse-submodules 'https://github.com/Piwigo/piwigo-bootstrap-darkroom.git' '/srv/www/media/themes/bootstrap_darkroom' && sudo chown -R 'wwwrun':'www' '/srv/www/media/themes'+  sudo git clone --branch 'master' --depth '1' --recurse-submodules 'https://github.com/Piwigo/piwigo-bootstrap-darkroom.git' '/srv/www/media/themes/bootstrap_darkroom' && sudo chown -R 'wwwrun':'www' '/srv/www/media/themes' && sudo chmod -R '0755' '/srv/www/media/themes'
  
 ====== Database ====== ====== Database ======
Line 51: Line 51:
   GRANT ALL PRIVILEGES ON piwigo.* to 'piwigo'@'localhost';   GRANT ALL PRIVILEGES ON piwigo.* to 'piwigo'@'localhost';
  
-  FLUSH PRIVILEGES; +  FLUSH PRIVILEGES;EXIT;
- +
-  EXIT+
  
 ====== nginx + PHP-FPM Configuration ====== ====== nginx + PHP-FPM Configuration ======
Line 83: Line 81:
  
 ; General ; General
 +php_value[log_errors] = "0"
 +php_value[error_reporting] = "~E_ALL"
 php_value[date.timezone] = "America/New_York" php_value[date.timezone] = "America/New_York"
 php_value[max_execution_time] = "200" php_value[max_execution_time] = "200"
Line 234: Line 234:
 <code> <code>
 [Unit] [Unit]
-Description=Piwigo Updater+Description=Piwigo Git Updater
 After=network-online.target After=network-online.target
 Wants=network-online.target Wants=network-online.target
Line 243: Line 243:
  
 [Install] [Install]
-WantedBy=timers.target</code>+WantedBy=timers.target
  
-===== Maintenance ===== +# End</code>
- +
-==== Service ==== +
- +
-  sudo -e '/etc/systemd/system/media-m.service' +
- +
-<code> +
-[Service] +
-User=nginx +
-Group=nginx +
-Type=oneshot +
-ExecStart='/usr/bin/git' -C '/var/www/media' gc --aggressive --prune='all' +
-ExecStart='/usr/bin/git' -C '/var/www/media' fsck --full --strict +
-ExecStart='/usr/bin/git' -C '/var/www/media/themes/bootstrap_darkroom' gc --aggressive --prune='all' +
-ExecStart='/usr/bin/git' -C '/var/www/media/themes/bootstrap_darkroom' fsck --full --strict +
-ExecStartPost='/usr/bin/sync'</code> +
- +
-==== Timer ==== +
- +
-  * ''01'' day of every month at ''05:20:00'' +
- +
-  sudo -e '/etc/systemd/system/media-m.timer' && sudo systemctl daemon-reload && sudo systemctl enable 'media-m.timer' --now && sudo systemctl start 'media-m' && sudo systemctl status 'media-m' -l +
- +
-<code> +
-[Unit] +
-Description=Piwigo Maintenance +
-After=network-online.target +
-Wants=network-online.target +
- +
-[Timer] +
-OnCalendar=*-*-01 05:20:00 +
-Persistent=true +
- +
-[Install] +
-WantedBy=timers.target</code>+
  
 ===== Backup ===== ===== Backup =====
Line 292: Line 258:
 [Service] [Service]
 Type=oneshot Type=oneshot
-WorkingDirectory=/var/www + 
-ExecStart='/usr/bin/bash' -c '"/usr/bin/tar" -czf "/home/CHANGEME/backups/piwigo-files-auto-"$$(date +%%Y-%%m-%%d)".tar.gz" "media"' +ExecStart='/usr/bin/bash' -c '"/usr/bin/tar" -czf "/home/CHANGEME/backups/piwigo-files-auto-"$$(date +%%Y-%%m-%%d)".tar.gz" -C "/srv/www" "media"' 
-ExecStartPost='/usr/bin/sync'</code>+ 
 +ExecStartPost='/usr/bin/sync' 
 + 
 +# End</code>
  
 === Timer === === Timer ===
  
-  * ''01'' day of every month at ''05:35:00''+  * ''01'' day of every month at ''01:15:00''
  
-  sudo -e '/etc/systemd/system/media-fb.timer' && sudo systemctl daemon-reload && sudo systemctl enable 'media-fb.timer' --now && sudo systemctl start 'media-fb' && sudo systemctl status 'media-fb' -l+  sudo -e '/etc/systemd/system/media-fb.timer' && sudo systemctl daemon-reload && sudo systemctl enable 'media-fb.timer' --now
  
 <code> <code>
Line 307: Line 276:
  
 [Timer] [Timer]
-OnCalendar=*-*-01 05:35:00+OnCalendar=*-*-01 01:15:00
 Persistent=true Persistent=true
  
 [Install] [Install]
-WantedBy=timers.target</code>+WantedBy=timers.target 
 + 
 +# End</code> 
 + 
 +  sudo systemctl start 'media-fb' && sudo systemctl status 'media-fb' -l
  
 ==== Database ==== ==== Database ====
Line 317: Line 290:
 === Database Auth === === Database Auth ===
  
-  sudo mkdir -p '/var/lib/mysql/auth' && sudo -e '/var/lib/mysql/auth/piwigo' && sudo chown -R 'mysql':'mysql' '/var/lib/mysql/auth/piwigo' && sudo chmod '600' '/var/lib/mysql/auth/piwigo' && sync+  sudo mkdir -p '/var/lib/mysql/auth' && sudo -e '/var/lib/mysql/auth/piwigo' && sudo chown 'mysql':'mysql' '/var/lib/mysql/auth/piwigo' && sudo chmod '0600' '/var/lib/mysql/auth/piwigo'
  
 <code> <code>
 [mariadb-dump] [mariadb-dump]
 user=piwigo user=piwigo
-password=x</code>+password=x 
 + 
 +# End</code>
  
 === Service === === Service ===
Line 330: Line 305:
 <code> <code>
 [Service] [Service]
 +Group=mysql
 Type=oneshot Type=oneshot
-WorkingDirectory=/var/lib/mysql/tmp + 
-ExecStartPre='/usr/bin/mariadb-dump--defaults-extra-file='/var/lib/mysql/auth/piwigo--single-transaction 'piwigo' -r '/var/lib/mysql/tmp/piwigo.sql' +ExecStart='/usr/bin/bash' -c '"/usr/bin/mariadb-dump--defaults-extra-file="/var/lib/mysql/auth/piwigo--single-transaction --quick "piwigo" -r "/home/CHANGEME/backups/piwigo-database-auto-"$$(date +%%Y-%%m-%%d)".sql"' 
-ExecStart='/usr/bin/gzip' -f '/var/lib/mysql/tmp/piwigo.sql' + 
-ExecStart='/usr/bin/bash' -c '"/usr/bin/mv" "/var/lib/mysql/tmp/piwigo.sql.gz" "/home/CHANGEME/backups/piwigo-database-auto-"$$(date +%%Y-%%m-%%d)".sql.gz"' +ExecStartPost='/usr/bin/sync' 
-ExecStartPost='/usr/bin/sync'</code>+ 
 +# End</code>
  
 === Timer === === Timer ===
  
-  * Every day at ''05:45:00''+  * ''01'' day of every month at ''01:10:00''
  
   sudo -e '/etc/systemd/system/media-db.timer' && sudo systemctl daemon-reload && sudo systemctl enable 'media-db.timer' --now && sudo systemctl start 'media-db' && sudo systemctl status 'media-db' -l   sudo -e '/etc/systemd/system/media-db.timer' && sudo systemctl daemon-reload && sudo systemctl enable 'media-db.timer' --now && sudo systemctl start 'media-db' && sudo systemctl status 'media-db' -l
Line 349: Line 326:
  
 [Timer] [Timer]
-OnCalendar=*-*-* 05:45:00+OnCalendar=*-*-01 01:10:00
 Persistent=true Persistent=true
  
 [Install] [Install]
-WantedBy=timers.target</code>+WantedBy=timers.target 
 + 
 +# End</code> 
 + 
 +===== Maintenance ===== 
 + 
 +==== Service ==== 
 + 
 +  sudo -e '/etc/systemd/system/media-m.service' 
 + 
 +<code> 
 +[Service] 
 +User=wwwrun 
 +Group=www 
 +Type=oneshot 
 + 
 +ExecStart='/usr/bin/git' -C '/srv/www/media' reset --hard 
 +ExecStart='/usr/bin/git' -C '/srv/www/media' gc --aggressive --prune='all' 
 +ExecStart='/usr/bin/git' -C '/srv/www/media' fsck --full --strict 
 + 
 +ExecStart='/usr/bin/git' -C '/srv/www/media/themes/bootstrap_darkroom' reset --hard 
 +ExecStart='/usr/bin/git' -C '/srv/www/media/themes/bootstrap_darkroom' gc --aggressive --prune='all' 
 +ExecStart='/usr/bin/git' -C '/srv/www/media/themes/bootstrap_darkroom' fsck --full --strict 
 + 
 +ExecStartPost='/usr/bin/sync' 
 + 
 +# End</code> 
 + 
 +==== Timer ==== 
 + 
 +  * ''01'' day of every month at ''01:30:00'' 
 + 
 +  sudo -e '/etc/systemd/system/media-m.timer' && sudo systemctl daemon-reload && sudo systemctl enable 'media-m.timer' --now 
 + 
 +<code> 
 +[Unit] 
 +Description=Piwigo Maintenance 
 +After=network-online.target 
 +Wants=network-online.target 
 + 
 +[Timer] 
 +OnCalendar=*-*-01 01:30:00 
 +Persistent=true 
 + 
 +[Install] 
 +WantedBy=timers.target 
 + 
 +# End</code> 
 + 
 +  sudo systemctl start 'media-m' && sudo systemctl status 'media-m' -l
  
 ====== Backup ====== ====== Backup ======
Line 411: Line 437:
   sudo mariadb 'piwigo' < ~/'piwigo'*'.sql'   sudo mariadb 'piwigo' < ~/'piwigo'*'.sql'
  
-===== dos2unix =====+===== Git Fix =====
  
-****+  :!: Set email for ''user.email'' 
 + 
 +  sudo su 'wwwrun' -s '/bin/bash' 
 + 
 +  rm -Rf '/srv/www/media/.git' 
 + 
 +  git -C '/srv/www/media' init --initial-branch='master' 
 + 
 +  git -C '/srv/www/media' add '.' 
 + 
 +  git -C '/srv/www/media' config 'user.email' 'espionage724@x' 
 + 
 +  git -C '/srv/www/media' commit --message='x' 
 + 
 +  git -C '/srv/www/media' remote add 'origin' 'https://github.com/Piwigo/Piwigo.git' 
 + 
 +  git -C '/srv/www/media' pull --depth '1' --recurse-submodules 'origin' 'master' --rebase 
 + 
 +  git -C '/srv/www/media' reset --hard 'origin/master' 
 + 
 +  git -C '/srv/www/media' gc --aggressive --prune='all' 
 + 
 +  git -C '/srv/www/media' fsck --full --strict 
 + 
 +==== Bootstrap Darkroom ==== 
 + 
 +  :!: Set email for ''user.email'' 
 + 
 +  rm -Rf '/srv/www/media/themes/bootstrap_darkroom/.git' 
 + 
 +  git -C '/srv/www/media/themes/bootstrap_darkroom' init --initial-branch='master' 
 + 
 +  git -C '/srv/www/media/themes/bootstrap_darkroom' add '.' 
 + 
 +  git -C '/srv/www/media/themes/bootstrap_darkroom' config 'user.email' 'espionage724@x' 
 + 
 +  git -C '/srv/www/media/themes/bootstrap_darkroom' commit --message='x' 
 + 
 +  git -C '/srv/www/media/themes/bootstrap_darkroom' remote add 'origin' 'https://github.com/Piwigo/piwigo-bootstrap-darkroom.git' 
 + 
 +  git -C '/srv/www/media/themes/bootstrap_darkroom' pull --depth '1' --recurse-submodules 'origin' 'master' --rebase 
 + 
 +  git -C '/srv/www/media/themes/bootstrap_darkroom' reset --hard 'origin/master' 
 + 
 +  git -C '/srv/www/media/themes/bootstrap_darkroom' gc --aggressive --prune='all' 
 + 
 +  git -C '/srv/www/media/themes/bootstrap_darkroom' fsck --full --strict
  
-  find '/srv/www/media' -type f -print0 | sudo xargs -0 dos2unix -- && sudo chown -R 'wwwrun':'www' '/srv/www/media' && sudo chmod -R '0755' '/srv/www/media'+  exit
  
 ===== MySQL Connection ===== ===== MySQL Connection =====
Line 436: Line 508:
  
   rm -fv ~/'piwigo-files-'*'.tar.gz' ~/'piwigo'*'.sql'   rm -fv ~/'piwigo-files-'*'.tar.gz' ~/'piwigo'*'.sql'
- 
-====== Old Restore ====== 
- 
-===== Client ===== 
- 
-==== Uncompress Database ==== 
- 
-  * This is only needed if restoring an **automated** database backup ((manual doesn't gzip)) 
- 
-  gunzip ~/'Downloads/piwigo-database-'*'.sql.gz' 
  
/srv/www/wiki/data/attic/servers/linux/nginx/piwigo.1757589456.txt.gz · Last modified: by Sean Rhone