2.1. Iceshrimp

Installation of Iceshrimp with Docker

My preferred way of installing services on my VPS is Docker. So it is for Iceshrimp.

Great starting point on how to install Iceshrimp with docker is the documentation provided in the Iceshrimp git repository.

Docker Compose Configuration

Here is the docker-compose.yml derived from the provided example file.

version: "3"

services:
  web:
#   image: iceshrimp.dev/iceshrimp/iceshrimp:latest
    image: iceshrimp.dev/iceshrimp/iceshrimp:v2023.12.1 # Note 1
    container_name: iceshrimp_web
    restart: unless-stopped
    depends_on:                                         # Note 2
      db:
        condition: service_healthy
      redis:
        condition: service_healthy
    ports:
      - "3000:3000"
    networks:                                           # Note 3
      - default
      - proxy
    environment:
      NODE_ENV: production
    volumes:
      - ./files:/iceshrimp/files
      - ./.config:/iceshrimp/.config:ro
    healthcheck:                                        # Note 4
      test: wget -q -O /dev/null http://localhost:3000
      interval: 30s
      retries: 20

  redis:
    restart: unless-stopped
    image: docker.io/redis:7-alpine                     # Note 5
    container_name: iceshrimp_redis
    networks:                                           # Note 3
      - default
    volumes:
      - ./redis:/data
    healthcheck:                                        # Note 4
      test: "redis-cli ping"
      interval: 5s
      retries: 20

  db:
    restart: unless-stopped
    image: docker.io/postgres:16-alpine                 # Note 6
    # max_connections needed if clusterLimit >1 / Should be (10*clusterLimit)+10
    command: postgres -c 'max_connections=30'           # Note 7
    container_name: iceshrimp_db
    networks:                                           # Note 3
      - default
    env_file:
      - .config/docker.env
    volumes:
      - ./db:/var/lib/postgresql/data
    healthcheck:                                        # Note 4
      test: "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB"
      interval: 5s
      retries: 20

networks:                                               # Note 3
  default:
  proxy:
    external: true
    name: proxy

The positions I changed in docker-compose.yml are marked with Note x:

  • Note 1: The Iceshrimp image name has been replaced with the newest release label. This allows for controlled version updates.
  • Note 2: For all services a healthcheck is provided. Thus a health condition is added to the services Iceshrimp depends on. See also Note 4.
  • Note 3: The naming convention for all my docker stack internal networks is default. The network for the reverse proxy is proxy. Thus the networks statements are changed accordingly.
  • Note 4: Healthchecks for all services are added. See also Note 2.
  • Note 5: The redis image name has changed to use the newest version 7.x instead of demanding 7.0.
  • Note 6: The postgres image name has changed to use the newest version 16.x.
  • Note 7: In my configuration two CPU threads are used. The postgres maximum connections are adapted accodingly (see documentation).

Configuration of Reverse Proxy

I am using Caddyserver as reverse proxy. To handle the new Iceshrimp server, following lines need to be added to the Caddyfile:

your.example.com {
        reverse_proxy iceshrimp_web:3000
}

your.example.com must be exchanged by the URL you are using for your Iceshrimp server.