Shifter

A simple, self-hosted file-sharing web app, powered by Django.

Directory Structure

    • .env
    • docker-compose.yml

docker-compose.yml

version: '3.7'
services:
  ## Uncomment this if you want to use postgres
  # db:
  #   image: postgres
  #   restart: always
  #   volumes:
  #     - db:/var/lib/postgresql/data
  #   env_file:
  #     - ../.env
  web:
    image: ghcr.io/tobysuch/shifter:0.3.0
    restart: always
    volumes:
      - ./static:/home/app/web/static_root
      - ./media:/home/app/web/media
      - ./db:/home/app/web/db # Comment this out if you are using postgres
    expose:
      - 8000
    env_file:
      - ../.env
  nginx:
    image: nginx:1.19.0-alpine
    volumes:
      - static:/home/app/web/static
      - media:/home/app/web/media
      - ../nginx/nginx.conf:/etc/nginx/templates/default.conf.template
    ports:
      - 1337:80
    depends_on:
      - web
    env_file:
      - ../.env
	  restart: unless-stopped

.env

### Django settings ###
DEBUG=0    # 1 for dev, 0 for prod
SECRET_KEY=CHANGEME # Generate a long random string of characters for this. Example command: openssl rand -base64 64
DJANGO_ALLOWED_HOSTS=localhost 127.0.0.1 [::1]
CSRF_TRUSTED_ORIGINS=https://mydomain.com
SHIFTER_FULL_DOMAIN=https://shifter.mydomain.com
DJANGO_LOG_LEVEL=INFO
DJANGO_LOG_LOCATION=/var/log/shifter.log
TIMEZONE=UTC
EXPIRED_FILE_CLEANUP_SCHEDULE=*/15 * * * *  # Cron schedule for cleaning up expired files. Default is every 15 minutes.
 
 
 
### Nginx settings ###
CLIENT_MAX_BODY_SIZE=5G  # Max size of uploaded file allowed by Nginx
 
 
### Database settings ###
DATABASE=sqlite  # Possible values: sqlite, postgres
 
# The following only need to be set if you choose postgres. They can be ignored if you choose sqlite.
# Don't forget to add a postgres container to your docker-compose.yml file if you choose postgres.
SQL_DATABASE=CHANGEME
SQL_USER=CHANGEME
SQL_PASSWORD=CHANGEME
SQL_HOST=db
SQL_PORT=5432
 
# Config for postgres db container - should match credentials above. You can usually ignore this, even if you choose postgres.
POSTGRES_DB=${SQL_DATABASE}
POSTGRES_USER=${SQL_USER}
POSTGRES_PASSWORD=${SQL_PASSWORD}
PGDATA=/var/lib/postgresql/data/

Resources

GitHub: https://github.com/TobySuch/Shifter

GitHub Container Registry: https://github.com/tobysuch/Shifter/pkgs/container/shifter

Configuration: https://github.com/TobySuch/Shifter#running-in-production