-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Server: Improved config and support for Docker
- Loading branch information
Showing
34 changed files
with
442 additions
and
323 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,26 @@ | ||
# Example of local config, for development: | ||
# ============================================================================= | ||
# PRODUCTION CONFIG EXAMPLE | ||
# ----------------------------------------------------------------------------- | ||
# By default it will use SQLite, but that's mostly to test and evaluate the | ||
# server. So you'll want to specify db connection settings to use Postgres. | ||
# ============================================================================= | ||
# | ||
# JOPLIN_BASE_URL=http://localhost:22300 | ||
# JOPLIN_PORT=22300 | ||
# APP_BASE_URL=https://example.com/joplin | ||
# APP_PORT=22300 | ||
# | ||
# DB_CLIENT=pg | ||
# POSTGRES_PASSWORD=joplin | ||
# POSTGRES_DATABASE=joplin | ||
# POSTGRES_USER=joplin | ||
# POSTGRES_PORT=5432 | ||
# POSTGRES_HOST=localhost | ||
|
||
# Example of config for production: | ||
# ============================================================================= | ||
# DEV CONFIG EXAMPLE | ||
# ----------------------------------------------------------------------------- | ||
# Example of local config, for development. In dev mode, you would usually use | ||
# SQLite so database settings are not needed. | ||
# ============================================================================= | ||
# | ||
# JOPLIN_BASE_URL=https://example.com/joplin | ||
# JOPLIN_PORT=22300 | ||
# APP_BASE_URL=http://localhost:22300 | ||
# APP_PORT=22300 |
This file was deleted.
Oops, something went wrong.
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,15 @@ | ||
# For development this compose file starts the database only. The app can then | ||
# be started using `npm run start-dev`, which is useful for development, because | ||
# it means the app Docker file doesn't have to be rebuilt on each change. | ||
|
||
version: '3' | ||
|
||
services: | ||
db: | ||
image: postgres:13.1 | ||
ports: | ||
- "5432:5432" | ||
environment: | ||
- POSTGRES_PASSWORD=joplin | ||
- POSTGRES_USER=joplin | ||
- POSTGRES_DB=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 |
---|---|---|
@@ -1,28 +1,27 @@ | ||
# For development, the easiest might be to only start the Postgres container and | ||
# run the app directly with `npm start`. Or use sqlite3. | ||
# This compose file can be used in development to run both the database and app | ||
# within Docker. | ||
|
||
version: '3' | ||
|
||
services: | ||
# app: | ||
# build: | ||
# context: . | ||
# dockerfile: Dockerfile.server-dev | ||
# ports: | ||
# - "22300:22300" | ||
# # volumes: | ||
# # - ./packages/server/:/var/www/joplin/packages/server/ | ||
# # - /var/www/joplin/packages/server/node_modules/ | ||
db: | ||
app: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile.db | ||
dockerfile: Dockerfile.server | ||
ports: | ||
- "22300:22300" | ||
environment: | ||
- DB_CLIENT=pg | ||
- POSTGRES_PASSWORD=joplin | ||
- POSTGRES_DATABASE=joplin | ||
- POSTGRES_USER=joplin | ||
- POSTGRES_PORT=5432 | ||
- POSTGRES_HOST=localhost | ||
db: | ||
image: postgres:13.1 | ||
ports: | ||
- "5432:5432" | ||
environment: | ||
# TODO: Considering the database is only exposed to the | ||
# application, and not to the outside world, is there a need to | ||
# pick a secure password? | ||
- POSTGRES_PASSWORD=joplin | ||
- POSTGRES_USER=joplin | ||
- POSTGRES_DB=joplin | ||
- POSTGRES_DB=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 |
---|---|---|
@@ -1,40 +1,34 @@ | ||
# This is a sample docker-compose file that can be used to run Joplin Server | ||
# along with a PostgreSQL server. | ||
# | ||
# All environment variables are optional. If you don't set them, you will get a | ||
# warning from docker-compose, however the app should use working defaults. | ||
|
||
version: '3' | ||
|
||
services: | ||
app: | ||
environment: | ||
- JOPLIN_BASE_URL=${JOPLIN_BASE_URL} | ||
- JOPLIN_PORT=${JOPLIN_PORT} | ||
restart: unless-stopped | ||
build: | ||
context: . | ||
dockerfile: Dockerfile.server | ||
ports: | ||
- "${JOPLIN_PORT}:${JOPLIN_PORT}" | ||
# volumes: | ||
# # Mount the server directory so that it's possible to edit file | ||
# # while the container is running. However don't mount the | ||
# # node_modules directory which will be specific to the Docker | ||
# # image (eg native modules will be built for Ubuntu, while the | ||
# # container might be running in Windows) | ||
# # https://stackoverflow.com/a/37898591/561309 | ||
# - ./packages/server:/home/joplin/packages/server | ||
# - /home/joplin/packages/server/node_modules/ | ||
db: | ||
restart: unless-stopped | ||
# By default, the Postgres image saves the data to a Docker volume, | ||
# so it persists whenever the server is restarted using | ||
# `docker-compose up`. Note that it would however be deleted when | ||
# running `docker-compose down`. | ||
build: | ||
context: . | ||
dockerfile: Dockerfile.db | ||
image: postgres:13.1 | ||
ports: | ||
- "5432:5432" | ||
restart: unless-stopped | ||
environment: | ||
- APP_PORT=22300 | ||
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD} | ||
- POSTGRES_USER=${POSTGRES_USER} | ||
- POSTGRES_DB=${POSTGRES_DATABASE} | ||
app: | ||
image: joplin/server:latest | ||
depends_on: | ||
- db | ||
ports: | ||
- "22300:22300" | ||
restart: unless-stopped | ||
environment: | ||
# TODO: Considering the database is only exposed to the | ||
# application, and not to the outside world, is there a need to | ||
# pick a secure password? | ||
- POSTGRES_PASSWORD=joplin | ||
- POSTGRES_USER=joplin | ||
- POSTGRES_DB=joplin | ||
- APP_BASE_URL=${APP_BASE_URL} | ||
- DB_CLIENT=pg | ||
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD} | ||
- POSTGRES_DATABASE=${POSTGRES_DATABASE} | ||
- POSTGRES_USER=${POSTGRES_USER} | ||
- POSTGRES_PORT=${POSTGRES_PORT} | ||
- POSTGRES_HOST=db |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Oops, something went wrong.
0d2bf6d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is recommended to state the reason on why it is recommended to do something, as otherwise it may just grow security theater.