diff --git a/api/.dockerignore b/api/.dockerignore new file mode 100644 index 0000000000000000000000000000000000000000..eaf79bde923eb6d8a46ed50f5c0a1fc2e5969a24 --- /dev/null +++ b/api/.dockerignore @@ -0,0 +1,69 @@ +### OSX ### +.DS_Store +.AppleDouble +.LSOverride + +### SublimeText ### +# cache files for sublime text +*.tmlanguage.cache +*.tmPreferences.cache +*.stTheme.cache + +# workspace files are user-specific +*.sublime-workspace + +# project files should be checked into the repository, unless a significant +# proportion of contributors will probably not be using SublimeText +# *.sublime-project + +# sftp configuration file +sftp-config.json + +# Basics +*.py[cod] +__pycache__ + +# Logs +*.log +pip-log.txt + +# Unit test / coverage reports +.coverage +.tox +nosetests.xml +htmlcov + +# Translations +*.mo +*.pot + +# Pycharm +.idea + +# Vim + +*~ +*.swp +*.swo + +# npm +front/node_modules/ + +# Compass +.sass-cache + +# virtual environments +.env + +# User-uploaded media +funkwhale_api/media/ + +# Hitch directory +tests/.hitch + +# MailHog binary +mailhog + +*.sqlite3 +music +media diff --git a/deploy/docker-compose.yml b/deploy/docker-compose.yml new file mode 100644 index 0000000000000000000000000000000000000000..9ce6ecd74d8fc3b85a81d519abebc83dd4063b40 --- /dev/null +++ b/deploy/docker-compose.yml @@ -0,0 +1,51 @@ +version: '3' + +services: + + postgres: + restart: unless-stopped + env_file: .env + image: postgres:9.4 + + redis: + restart: unless-stopped + env_file: .env + image: redis:3 + volumes: + - ./data:/data + + celeryworker: + restart: unless-stopped + image: funkwhale/funkwhale:${FUNKWHALE_VERSION:-latest} + env_file: .env + command: python manage.py celery worker + links: + - postgres + - redis + environment: + - C_FORCE_ROOT=true + volumes: + - ./api/media:/app/funkwhale_api/media + + celerybeat: + restart: unless-stopped + image: funkwhale/funkwhale:${FUNKWHALE_VERSION:-latest} + env_file: .env + command: celery -A funkwhale_api.taskapp beat -l INFO + links: + - postgres + - redis + + api: + restart: unless-stopped + image: funkwhale/funkwhale:${FUNKWHALE_VERSION:-latest} + env_file: .env + command: ./compose/django/gunicorn.sh + volumes: + - ./data/media:/app/funkwhale_api/media + - ./data/static:/app/staticfiles + ports: + - "${FUNKWHALE_API_IP:-127.0.0.1}:${FUNKWHALE_API_PORT:-5000}:5000" + links: + - postgres + - redis diff --git a/deploy/env.prod.sample b/deploy/env.prod.sample new file mode 100644 index 0000000000000000000000000000000000000000..38d355cb19d91868ed472fb9333e7e73359db66d --- /dev/null +++ b/deploy/env.prod.sample @@ -0,0 +1,46 @@ +# If you're tweaking this file from the template, ensure you edit at lest the +# following variables: +# - DJANGO_SECRET_KEY +# - DJANGO_ALLOWED_HOSTS + +# Docker only +# ----------- + +# The tag of the image we should use +# (it will be interpolated in docker-compose file) +FUNKWHALE_VERSION=latest + + +# General configuration +# --------------------- + +# Set this variables to bind the API server to another interface/port +# example: FUNKWHALE_API_IP=0.0.0.0 +# example: FUNKWHALE_API_PORT=5678 +FUNKWHALE_API_IP= +FUNKWHALE_API_PORT= + +# API/Django configuration + +# which settings module should django use? +# You don't have to touch this unless you really know what you're doing +DJANGO_SETTINGS_MODULE=config.settings.production + +# Generate one using `openssl rand -base64 45`, for example +DJANGO_SECRET_KEY= + +# You don't have to edit this +DJANGO_ADMIN_URL=^admin/ + +# Update it to match the domain that will be used to reach your funkwhale +# instance +# Example: DJANGO_ALLOWED_HOSTS=funkwhale.yourdomain.com +DJANGO_ALLOWED_HOSTS=yourdomain + +# If True, unauthenticated users won't be able to query the API +API_AUTHENTICATION_REQUIRED=True + +# What is the workflow for registration on funkwhale ? Possible values: +# public: anybody can register an account +# disabled: nobody can register an account +REGISTRATION_MODE=disabled diff --git a/deploy/nginx.conf b/deploy/nginx.conf new file mode 100644 index 0000000000000000000000000000000000000000..32fe193f557e6602e92ea7b16d742f2626f4f556 --- /dev/null +++ b/deploy/nginx.conf @@ -0,0 +1,33 @@ +upstream funkwhale-api { + # depending on your setup, you may want to udpate this + server localhost:5000; +} + +server { + listen 80; + server_name demo.funkwhale.audio; + + root /srv/funkwhale/front/dist; + + location / { + try_files $uri $uri/ @rewrites; + } + + location @rewrites { + rewrite ^(.+)$ /index.html last; + } + location /api/ { + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto https; + proxy_redirect off; + proxy_pass http://funkwhale-api/api/; + } + location /media/ { + alias /srv/funkwhale/data/media/; + } + location /staticfiles/ { + alias /srv/funkwhale/data/staticfiles/; + } +}