# Joplin ### Serveur Joplin: https://github.com/laurent22/joplin/blob/dev/packages/server/README.md #### Créer les dossiers: ```bash $ mkdir /var/www/vhosts/maboiteverte.fr/docker/joplin $ mkdir /var/www/vhosts/maboiteverte.fr/docker/joplin/data ``` #### Créer le fichier `docker-compose.yml` dans `/var/www/vhosts/maboiteverte.fr/docker/joplin`: ```bash $ nano docker-compose.yml ``` ```yaml version: '3' services: db: image: postgres:13.1 ports: - "5432:5432" restart: unless-stopped volumes: - /var/www/vhosts/maboiteverte.fr/docker/joplin/data:/var/lib/postgresql/data environment: - APP_PORT=22300 - POSTGRES_PASSWORD=joplin - POSTGRES_USER=joplin - POSTGRES_DB=joplin app: image: joplin/server:2.4.1-beta depends_on: - db ports: - "22300:22300" restart: unless-stopped environment: - APP_BASE_URL=https://joplin.maboiteverte.fr - DB_CLIENT=pg - POSTGRES_PASSWORD=joplin - POSTGRES_DATABASE=joplin - POSTGRES_USER=joplin - POSTGRES_PORT=5432 - POSTGRES_HOST=db ``` #### Créer le container: ```bash $ sudo docker-compose up -d Creating network "joplin_default" with the default driver Pulling app (joplin/server:latest)... latest: Pulling from joplin/server ... Digest: sha256:5c4cd651d4dae4ce85e252efc9262856d07dd8e0cf9a9a2c077a36c9631883cb Status: Downloaded newer image for joplin/server:latest Creating joplin_db_1 ... done Creating joplin_app_1 ... done ``` Le serveur est disponible en local sur: http://localhost:22300 #### Créer une règle de proxy-inverse: Créer un sous-domaine **joplin.maboiteverte.fr** Créer une règle de proxy Docker: - URL: Joplin.maboiteverte.fr/ - Conteneur: Joplin_app_1 - Port: 22300 -> 22300 #### Voir les logs: ```bash $ sudo docker-compose --file docker-compose.yml logs Password: Attaching to joplin_app_1, joplin_db_1 app_1 | WARNING: no logs are available with the 'db' log driver db_1 | WARNING: no logs are available with the 'db' log driver ``` #### Mise-à-jour: ```bash bruno@localhost:~/docker/joplin$ sudo docker-compose stop [sudo] password for bruno: Stopping joplin_app_1 ... done Stopping joplin_db_1 ... done bruno@localhost:~/docker/joplin$ sudo docker-compose pull Pulling db (postgres:13.1)... 13.1: Pulling from library/postgres Digest: sha256:26180996f7d804993f9c90398615d1269709a799b5eb79109292843a1c7cd851 Status: Image is up to date for postgres:13.1 Pulling app (joplin/server:2.4.1-beta)... 2.4.1-beta: Pulling from joplin/server Digest: sha256:525ef4d9ecffe638c1e1eb9b85bdb7dc85a3dad51223206e60a3e588ab3bde52 Status: Image is up to date for joplin/server:2.4.1-beta bruno@localhost:~/docker/joplin$ sudo docker-compose up -d Starting joplin_db_1 ... Starting joplin_db_1 ... done Recreating joplin_app_1 ... Recreating joplin_app_1 ... done ``` ```bash COMPOSE_HTTP_TIMEOUT=200 sudo docker-compose up -d ``` ou ```bash nano .env ``` ```bash #.env COMPOSE_HTTP_TIMEOUT=200 ``` ## Backup / restore Joplin database ### Backup: ```bash $ docker exec -it joplin-server_db_1 pg_dumpall -U joplin > db.sql ``` ### Restore: ```bash $ docker exec -i joplin-server_db_1 psql -U joplin < db.sql ``` ### Application Joplin Préférences -> Synchronisation: Cible de la synchronisation: Joplin Server Serveur Joplin: - URL: https://joplin.maboiteverte.fr:22301 - Dossier: home - Utilisateur: bruno@xxx.info - Mot de passe: xxxxx ### Purger les anciennes images ```bash title="Liste des toutes les images" root@localhost:~# docker image ls REPOSITORY TAG IMAGE ID CREATED SIZE joplin/server latest 782cbde24b82 3 weeks ago 1.23GB joplin/server a26c4004d386 2 months ago 3.17GB joplin/server f9f69a3c0e96 3 months ago 2.64GB joplin/server f1a60289456e 4 months ago 2.61GB joplin/server 10eda2200dab 5 months ago 2.5GB postgres 13.1 407cece1abff 12 months ago 314MB ``` Les images sans tags apparaissent comme SHA256 dans Plesk. ```bash title="Liste de tous les containers" root@localhost:~# docker container ls --all CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 17d973e4c278 joplin/server:latest "tini -- node dist/a…" 2 weeks ago Up 2 weeks 0.0.0.0:22300->22300/tcp, :::22300->22300/tcp joplin_app_1 2eeccf277a3d postgres:13.1 "docker-entrypoint.s…" 7 months ago Up 2 weeks 0.0.0.0:5432->5432/tcp, :::5432->5432/tcp joplin_db_1 ``` ```bash title="Supression des images non  associées à un container" root@localhost:~# docker image prune -a WARNING! This will remove all images without at least one container associated to them. Are you sure you want to continue? [y/N] y Deleted Images: untagged: joplin/server@sha256:ecd8d71d0b8c972d85e9fa626b0f3b476bc72d0e82ec9afd1c63c951531ad9e1 delete ... untagged: joplin/server@sha256:17100fc5349199b8398ede4f7079f0ecbfbc5cca5a9e5fbcb17660f9b8496330 delete ... untagged: joplin/server@sha256:a2895e667ded09b6622111a58196ade878781ce2afbde19b3d5a12bd4ac8efb7 delete ... untagged: joplin/server@sha256:e70ee993aecbb8b7fdf6a24a8cacad1a73084f3c566abc50ef1dbfa48c247a47 delete ... Total reclaimed space: 10.09GB ```