How to setup Turtl server

Turtl is a great app, but it's barely supported and the server installation really isn't supported. If you follow instructions you find online you'll encounter two issues:

  1. File uploads fail.
  2. The database isn't persistent, if you restart the server you lose all of your notes.

How to install

Navigate to the desired location on your server. I usually use /opt.

cd /opt
sudo git clone https://github.com/turtl/server
cd server
sudo chown -R ${USER}:${USER} .

Decide what your URL will be. Will you host this on your internal network or make it publicly available? In this example we'll assume it's available on your local 10.0.0.x network.

Edit your docker-compose.yml file. Obviously change TURTL_DB_PASSWORD, TURTL_APP_SECURE_HASH_SALT, POSTGRES_PASSWORD, and change TURTL_APP_API_URL and TURTL_APP_WWW_URL to your actual addresses.

Very, very, very important. Add this. If you don't you'll lose all of your notes when you restart your server.

    volumes:
      - ./data/db:/var/lib/postgresql/data

Final docker-compose.yml

services:
  turtl-server:
    build:
      context: ./
    environment:
      TURTL_DB_HOST: postgres-db-turtl
      TURTL_DB_PORT: 5432
      TURTL_DB_DATABASE: database
      TURTL_DB_USER: user
      TURTL_DB_PASSWORD: password
      TURTL_APP_SECURE_HASH_SALT: salty
      TURTL_APP_API_URL: http://10.0.0.127:8181
      TURTL_APP_WWW_URL: http://10.0.0.127:8181
    ports:
      - 8181:8181
    depends_on:
      postgres-db-turtl:
        condition: service_healthy

  postgres-db-turtl:
    image: postgres:11-alpine
    volumes:
      - ./data/db:/var/lib/postgresql/data
    environment:
      POSTGRES_PASSWORD: password
      POSTGRES_USER: user
      POSTGRES_DB: database
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U turtl"]
      interval: 10s
      timeout: 5s
      retries: 5