Skip to content

Commit

Permalink
feat(joplin): Add Joplin Server
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrienPoupa committed Jan 4, 2024
1 parent 12b827a commit 3611962
Show file tree
Hide file tree
Showing 12 changed files with 158 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
COMPOSE_PROFILES=
COMPOSE_FILE=docker-compose.yml:adguardhome/docker-compose.yml:tandoor/docker-compose.yml
COMPOSE_FILE=docker-compose.yml:adguardhome/docker-compose.yml:tandoor/docker-compose.yml:joplin/docker-compose.yml
USER_ID=1000
GROUP_ID=1000
TIMEZONE="America/New_York"
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ I am running it in Ubuntu Server 22.04; I also tested this setup on a [Synology
* [DHCP](#dhcp)
* [Expose DNS Server with Tailscale](#expose-dns-server-with-tailscale)
* [Tandoor](#tandoor)
* [Joplin](#joplin)
* [Customization](#customization)
* [Optional: Using the VPN for *arr apps](#optional-using-the-vpn-for-arr-apps)
* [Synology Quirks](#synology-quirks)
Expand Down Expand Up @@ -72,6 +73,7 @@ I am running it in Ubuntu Server 22.04; I also tested this setup on a [Synology
| [FlareSolverr](https://github.com/FlareSolverr/FlareSolverr) | Optional - Proxy server to bypass Cloudflare protection in Prowlarr<br/>Enable with `COMPOSE_PROFILES=flaresolverr` | [flaresolverr/flaresolverr](https://hub.docker.com/r/flaresolverr/flaresolverr) | |
| [AdGuard Home](https://adguard.com/en/adguard-home/overview.html) | Optional - Network-wide software for blocking ads & tracking<br/>Enable with `COMPOSE_PROFILES=adguardhome` | [adguard/adguardhome](https://hub.docker.com/r/adguard/adguardhome) | |
| [Tandoor](https://tandoor.dev) | Optional - Smart recipe management<br/>Enable with `COMPOSE_PROFILES=tandoor` | [vabene1111/recipes](https://hub.docker.com/r/vabene1111/recipes) | /recipes |
| [Joplin](https://joplinapp.org/) | Optional - Note taking application<br/>Enable with `COMPOSE_PROFILES=joplin` | [joplin/server](https://hub.docker.com/r/joplin/server) | /joplin |

Optional containers are not enabled by default, they need to be enabled,
see [Optional Services](#optional-services) for more information.
Expand Down Expand Up @@ -370,6 +372,10 @@ Just make sure that AdGuard Home listens to all interfaces.
See [here](./tandoor/README.md).
### Joplin
See [here](./joplin/README.md).
## Customization
You can override the configuration of a service or add new services by creating a new `docker-compose.override.yml` file,
Expand Down
8 changes: 8 additions & 0 deletions joplin/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
MAILER_ENABLED=false
MAILER_HOST=
MAILER_PORT=465
MAILER_SECURITY=MailerSecurity.Tls
MAILER_AUTH_USER=
MAILER_AUTH_PASSWORD=
MAILER_NOREPLY_NAME=
MAILER_NOREPLY_EMAIL=
4 changes: 4 additions & 0 deletions joplin/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/database
/storage
.env
backup.env
49 changes: 49 additions & 0 deletions joplin/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Joplin

[Joplin](https://joplinapp.org/) is an open source note-taking app. Capture your thoughts and securely access them from any device.

This service lets you host your own Joplin server, which your clients can connect to.

## Installation

Enable Joplin by setting `COMPOSE_PROFILES=joplin`. It will be accessible at `/joplin`.

Copy the example environment file and edit as needed before running Joplin: `cp joplin/env.example joplin/.env`.

## Backup

Joplin's database and media files can be backed up in the cloud storage product of your choice with [Rclone](https://rclone.org/).

Before a backup can be made, `rclone config` must be run to generate the configuration file:

```shell
docker compose run --rm -it joplin-backup rclone config
```

It will generate a `rclone.conf` configuration file in ./joplin/rclone/rclone.conf.

Copy the backup environment file to `backup.env` and fill it as needed:
`cp backup.env.exmple backup.env`

| Variable | Description | Default |
|------------------------|---------------------------------------------------------------------|---------------------------|
| `MAILER_ENABLED` | Enable Joplin mailer | `false` |
| `MAILER_HOST` | Mailer hostname | |
| `MAILER_PORT` | Mailer port | `465` |
| `MAILER_SECURITY` | Mailer security protocol | `MailerSecurity.Tls` |
| `MAILER_AUTH_USER` | Mailer user | |
| `MAILER_AUTH_PASSWORD` | Mailer password | |
| `MAILER_NOREPLY_NAME` | No reply email name | |
| `MAILER_NOREPLY_EMAIL` | No reply email address | |
| `RCLONE_REMOTE_NAME` | Name of the remote you chose during rclone config | |
| `RCLONE_REMOTE_DIR` | Name of the rclone remote dir, eg: S3 bucket name, folder name, etc | |
| `CRON` | How often to run the backup | `@daily` backup every day |
| `TIMEZONE` | Timezone, used for cron times | `America/New_York` |
| `ZIP_PASSWORD` | Password to protect the backup archive with | `123456` |
| `BACKUP_KEEP_DAYS` | How long to keep the backup in the destination | `31` days |

You can test your backup manually with:

```shell
docker compose run --rm -it joplin-backup backup
```
6 changes: 6 additions & 0 deletions joplin/backup.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
RCLONE_REMOTE_NAME=
RCLONE_REMOTE_DIR=
CRON=@daily
TIMEZONE=America/New_York
ZIP_PASSWORD=123456
BACKUP_KEEP_DAYS=31
File renamed without changes.
55 changes: 55 additions & 0 deletions joplin/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
services:
joplin:
image: joplin/server:latest
user: root # Not pretty, but non-root breaks volumes: https://github.com/laurent22/joplin/issues/9489
container_name: joplin
restart: always
environment:
- APP_PORT=22300
- APP_BASE_URL=https://${HOSTNAME}/joplin
- HOSTNAME=${HOSTNAME}
- DB_CLIENT=sqlite3
- SQLITE_DATABASE=/database/joplin.db
- STORAGE_DRIVER=Type=Filesystem; Path=/storage
volumes:
- ./joplin/database:/database
- ./joplin/storage:/storage
- ./joplin/healthcheck:/healthcheck
healthcheck:
test: ["CMD", "node", "/healthcheck/healthcheck.js"]
interval: 5s
retries: 10
labels:
- traefik.enable=true
- traefik.http.routers.joplin.rule=(Host(`${HOSTNAME}`) && PathPrefix(`/joplin`))
- traefik.http.routers.joplin.tls=true
- traefik.http.routers.joplin.tls.certresolver=myresolver
- traefik.http.routers.joplin.middlewares=joplin-stripprefix
- traefik.http.middlewares.joplin-stripprefix.stripPrefix.prefixes=/joplin
- traefik.http.services.joplin.loadbalancer.server.port=22300
- homepage.group=Apps
- homepage.name=joplin
- homepage.icon=joplin.png
- homepage.href=/joplin
- homepage.description=Note-taking application
- homepage.weight=2
profiles:
- joplin

joplin-backup:
image: adrienpoupa/rclone-backup:latest
container_name: joplin-backup
restart: always
env_file:
- ./joplin/backup.env
environment:
- BACKUP_FOLDER_NAME=storage
- BACKUP_FOLDER_PATH=/storage
- DB_TYPE=sqlite
- SQLITE_DATABASE=/database/joplin.db
volumes:
- ./joplin/database:/database
- ./joplin/storage:/storage
- ./joplin/backup:/config
profiles:
- joplin
28 changes: 28 additions & 0 deletions joplin/healthcheck/healthcheck.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Inspired by: https://anthonymineo.com/docker-healthcheck-for-your-node-js-app/
const http = require('http');
const options = {
host: '127.0.0.1',
port: 22300,
timeout: 2000,
path: '/api/ping',
headers: {
'Host': process.env.HOSTNAME,
}
};

const healthCheck = http.request(options, (res) => {
console.log(`HEALTHCHECK STATUS: ${res.statusCode}`);
if (res.statusCode === 200) {
process.exit(0);
}
else {
process.exit(1);
}
});

healthCheck.on('error', function (err) {
console.error('ERROR:' + err);
process.exit(1);
});

healthCheck.end();
2 changes: 1 addition & 1 deletion tandoor/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Tandoor

Tandoor is a recipe manager that allows you to manage your ever growing collection of digital recipes.
[Tandoor](https://tandoor.dev/) is a recipe manager that allows you to manage your ever growing collection of digital recipes.

## Installation

Expand Down
Empty file removed tandoor/database/.gitkeep
Empty file.
Empty file removed tandoor/mediafiles/.gitkeep
Empty file.

0 comments on commit 3611962

Please sign in to comment.