No description
- Groovy 69.9%
- Shell 11.5%
- JavaScript 11.5%
- Less 3.7%
- CSS 3.3%
- Other 0.1%
| buildSrc | ||
| docker | ||
| gradle/wrapper | ||
| grails-app | ||
| src | ||
| tools | ||
| .editorconfig | ||
| .gitignore | ||
| .sdkmanrc-template | ||
| build.gradle | ||
| deploy2DockerLocal.sh | ||
| deploy2PROD-ALL.sh | ||
| deploy2PROD1.sh | ||
| deploy2PROD2.sh | ||
| deploy2STAGE.sh | ||
| deploy2STAGE1.sh | ||
| deploy2STAGE2.sh | ||
| deployDocker2PROD.sh | ||
| deployDocker2Stage.sh | ||
| gradle.properties | ||
| gradlew | ||
| grails-cli.yml | ||
| INSTALL.md | ||
| README.md | ||
| settings.gradle | ||
| TODO.md | ||
Update instance (blue/green deployment)
- Open a shell in the HAProxy docker container
docker exec -it k4proxy /bin/sh
- Inside the container
# Make sure, socat is installed
apk add socat
# show backend servers
echo "show servers state" | socat unix-connect:/var/run/haproxy.sock stdio
# disable one server
echo "disable server k4webservers/s1" | socat unix-connect:/var/run/haproxy.sock stdio
- Update instance (outside the container)
./deploy2PROD1.sh
- If everything is fine (Logs, etc.), then enable the backend server in the docker container again
# enable first server again
echo "enable server k4webservers/s1" | socat unix-connect:/var/run/haproxy.sock stdio
# and disable the other server
echo "disable server k4webservers/s2" | socat unix-connect:/var/run/haproxy.sock stdio
- Then update the other instance (outside the container)
./deploy2PROD2.sh
Upgrade PostGres (different DB install users, at least one of them "root"; i.e. before v16)
- Dump old data
docker exec -it pdgbK4P /bin/bash
pg_dump -d k4photographers -U root > dumpK4P.sql
- stop all containers
- copy
/docker/dbdirectory to/docker/db<oldVersion> - empty
/docker/db/datadirectory (keepdocker-entrypoint-initdb.d) - start (upgraded) postgres container
pgdbK4Pto initialize the new version database - Restore DB dump on new machine (dwhprovider data restore will not work)
docker exec -it pdgbK4P /bin/bash
psql -d k4photographers -U postgres < dumpK4P.sql
- Start K4P Grails Application to initialize everything code related (or additional missing columns)
- Run etl.groovy script with MIN_INVOICE=1 and MIN_ASSET=1 to fetch all data initially.
Upgrade PostGres (same DB install users, but not "root"; i.e. from v16 on)
Background: The pg_upgrade command is designed to upgrade f.e. the layout of the system tables; while a
simple dump-and-restore writes all data again and might fail with constraint errors, pg_upgrade
aims to update system data only and to reuse the old user data as-is.
Unfortunately the "root" table is a system table, which is also present for a database install user "root".
So, if you chose to install PostGres against the recommendations as "root" it breaks pg_upgrade
(and probably pg_restore etc., too).
- stop all containers
- copy
/docker/dbdirectory to/docker/db<oldVersion>(and additional backup folder) - empty
/docker/dbdirectory, (re)add empty/docker/db/datafolder (nodocker-entrypoint-initdb.d!) - start (upgraded) postgres container
pgdbK4Pto initialize the new version database - stop the (upgraded) postgres container again
- build the upgrade container
docker build -t pg_upgrade_15-16:latest -f Upgrade_Dockerfile .
# Upgrade_Dockerfile
FROM postgres:16
ENV PGBINOLD=/usr/lib/postgresql/15/bin/
ENV PGBINNEW=/usr/lib/postgresql/16/bin/
ENV PGDATAOLD=/var/lib/postgresql/olddata
ENV PGDATANEW=/var/lib/postgresql/data
RUN apt-get update && apt-get install -y postgresql-15
USER postgres
WORKDIR /var/lib/postgresql/
CMD [ "/usr/lib/postgresql/16/bin/pg_upgrade" ]
- start the upgrade container with both db volumes mounted
docker run -ti -v "./db15/data:/var/lib/postgresql/olddata" \
-v "./db/data:/var/lib/postgresql/data" pg_upgrade_15-16