Operations grimoire/Penpot

From Nasqueron Agora

Penpot allows to experiment with UX, design and prototypes. It's hosted on our Docker PaaS.

This is a product under evaluation, feedback can be added to T1703.

Howto

Upgrade

There are two things to know:

  • We pull 3 images, run 2 of them as container, the last one - frontend - is only used to copy resources to our main nginx
  • The frontend and backend versions must match

Step 1 - Front-end preparation

First step is to update front-end at https://artifacts.nasqueron.org/penpot/penpot.tar.gz

On Dwellers:

  1. Pull the front-end image: docker pull penpotapp/frontend
  2. Spawn a new container with docker run --rm -it penpotapp/frontend bash
  3. Archive the /var/www/app folder: cd /var/www && tar czf penpot.tar.gz app/
  4. Copy it to the artifacts.nasqueron.org penpot folder: docker cp <penpot container>:/var/www/penpot.tar.gz /srv/artifacts/penpot/

Step 2 - Back-end and exporter

On docker-002:

  1. Pull the images penpotapp/exporter, penpotapp/frontend and penpotapp/backend
  2. Delete the file Salt uses to know front-end is deployed: rm /srv/penpot/public/version.txt
  3. Deploy the service with deploy_container penpot_exporter and deploy-container penpot_web

To check migrations

On docker-002, you should wee with docker logs penpot_web something like:

[2024-01-17 23:50:57.865] I app.db - hint="initialize connection pool", name="main", uri="postgresql://penpot_db/penpot", read-only=false, with-credentials=true, min-size=0, max-size=60
[2024-01-17 23:50:57.892] I app.migrations - hint="running migrations", module=:app.migrations/migrations
[2024-01-17 23:50:58.123] I app.util.migrations - action="apply migration", module="main", name="0102-mod-access-token-table"
[2024-01-17 23:50:58.180] I app.util.migrations - action="apply migration", module="main", name="0103-mod-file-object-thumbnail-table"
[2024-01-17 23:50:58.345] I app.util.migrations - action="apply migration", module="main", name="0104-mod-file-thumbnail-table"
[2024-01-17 23:50:58.349] I app.util.migrations - action="apply migration", module="main", name="0105-mod-server-error-report-table"

Troubleshoot

PostgreSQL

You can open a PostgreSQL console with docker exec -it penpot_db psql -U penpot.

Front-end vs back-end version

Versions for back-end and front-end need to match, especially as Penpot is developed with a rather fast pace.

  • Front-end: `cat /srv/penpot/public/version.txt`
  • Back-end: `docker exec penpot_web cat version.txt`

To ask Salt to redeploy front-end on docker-002:

   rm /srv/penpot/public/version.txt
   deploy-container penpot_web

Front-end can't find resources

Ensure nginx configuration is still up-to-date by comparing rOPS: roles/paas-docker/nginx/files/vhosts/penpot_web.conf and /etc/nginx/nginx.conf in the container. Container can be run with docker run --rm -it penpotapp/frontend bash.