servers/psmf: add psmf server docs, nginx/tailscale config, and data-sync
Document the psmf host (DNS, second tailscale netns instance, nginx vhosts, migration plan) and add the docker-dev-22 psmf-data-sync service plus the storage-23 pg_hba.conf entry it needs. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
93
servers/psmf/migration-plan.md
Normal file
93
servers/psmf/migration-plan.md
Normal file
@@ -0,0 +1,93 @@
|
||||
# Migration from horst-1 to horst-2
|
||||
|
||||
## postgres database
|
||||
|
||||
```bash
|
||||
# [DONE] install postgres
|
||||
apt update
|
||||
apt install -y curl ca-certificates gnupg lsb-release
|
||||
|
||||
# PGDG signing key (keyring-style, not the deprecated apt-key)
|
||||
sudo install -d /usr/share/postgresql-common/pgdg
|
||||
sudo curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc \
|
||||
-o /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc
|
||||
|
||||
# repo
|
||||
echo "deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] \
|
||||
https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" \
|
||||
| sudo tee /etc/apt/sources.list.d/pgdg.list
|
||||
|
||||
sudo apt update
|
||||
sudo apt install -y postgresql-18 postgresql-contrib-18
|
||||
|
||||
# backup database from horst-1
|
||||
# users backup
|
||||
pg_dumpall --globals-only -h 10.0.0.5 -U postgres > /tmp/pg-dumpall-globals
|
||||
# data backup
|
||||
pg_dump -h 10.0.0.5 -U postgres -C psmf > /tmp/psmf.pgsql
|
||||
|
||||
# restore backup of database from horst-1
|
||||
# create users
|
||||
cat /tmp/pg-dumpall-globals | psql
|
||||
# restore psmf database
|
||||
cat /tmp/psmf.pgsql | psql
|
||||
|
||||
# install docker oin horst-2
|
||||
# Docker's GPG key (keyring, not apt-key)
|
||||
sudo install -m 0755 -d /etc/apt/keyrings
|
||||
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg \
|
||||
-o /etc/apt/keyrings/docker.asc
|
||||
sudo chmod a+r /etc/apt/keyrings/docker.asc
|
||||
|
||||
# repo
|
||||
echo \
|
||||
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] \
|
||||
https://download.docker.com/linux/ubuntu \
|
||||
$(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}") stable" | \
|
||||
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
|
||||
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y \
|
||||
docker-ce docker-ce-cli containerd.io \
|
||||
docker-buildx-plugin docker-compose-plugin
|
||||
|
||||
|
||||
# [DONE] dockerize php intranet app
|
||||
# dockerized + upgraded to PHP 8.3.31
|
||||
|
||||
# [DONE] start psmf app on horst-2 and point it to database on horst
|
||||
|
||||
# [TODO] point php app on horst-1 to horst-2
|
||||
|
||||
# validate application is still working
|
||||
# [OK] - wkhtml - PDF printing of html pages
|
||||
# prepare local backups
|
||||
# validate if pg sync to api still works from horst-1
|
||||
# set sync to api on horst-2
|
||||
# install nginx and configure default site as reverse proxy to horst-1
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y nginx
|
||||
|
||||
# drop the proxy config in place (file lives in this repo at servers/psmf/files/nginx/default)
|
||||
sudo install -m 0644 -o root -g root \
|
||||
servers/psmf/files/nginx/default /etc/nginx/sites-available/default
|
||||
|
||||
# sites-enabled/default is already a symlink to ../sites-available/default on a stock Ubuntu install
|
||||
sudo nginx -t
|
||||
sudo systemctl reload nginx
|
||||
sudo systemctl enable nginx
|
||||
|
||||
# intranet vhosts: psmf.intranet -> horst-1, psmf-new.intranet -> local docker app
|
||||
# (depends on the dnsmasq setup in servers/psmf/dns-configuration.md)
|
||||
sudo install -m 0644 -o root -g root \
|
||||
servers/psmf/files/nginx/psmf.intranet /etc/nginx/sites-available/psmf.intranet
|
||||
sudo install -m 0644 -o root -g root \
|
||||
servers/psmf/files/nginx/psmf-new.intranet /etc/nginx/sites-available/psmf-new.intranet
|
||||
|
||||
sudo ln -sf ../sites-available/psmf.intranet /etc/nginx/sites-enabled/psmf.intranet
|
||||
sudo ln -sf ../sites-available/psmf-new.intranet /etc/nginx/sites-enabled/psmf-new.intranet
|
||||
|
||||
sudo nginx -t
|
||||
sudo systemctl reload nginx
|
||||
|
||||
```
|
||||
Reference in New Issue
Block a user