-
Notifications
You must be signed in to change notification settings - Fork 155
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
12b827a
commit 3611962
Showing
12 changed files
with
158 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/database | ||
/storage | ||
.env | ||
backup.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.