WIP: Debian installation instructions
This commit is contained in:
parent
6adc8f0cde
commit
d63e7677e4
25 changed files with 574 additions and 126 deletions
|
|
@ -4,7 +4,7 @@ set -e
|
|||
# Since docker-compose relies heavily on environment variables itself for configuration, we'd have to define multiple
|
||||
# environment variables just to support cookiecutter out of the box. That makes no sense, so this little entrypoint
|
||||
# does all this for us.
|
||||
export REDIS_URL=redis://redis:6379/0
|
||||
export CACHE_URL=redis://redis:6379/0
|
||||
|
||||
# the official postgres image uses 'postgres' as default user if not set explictly.
|
||||
if [ -z "$POSTGRES_ENV_POSTGRES_USER" ]; then
|
||||
|
|
@ -13,7 +13,7 @@ fi
|
|||
|
||||
export DATABASE_URL=postgres://$POSTGRES_ENV_POSTGRES_USER:$POSTGRES_ENV_POSTGRES_PASSWORD@postgres:5432/$POSTGRES_ENV_POSTGRES_USER
|
||||
|
||||
export CELERY_BROKER_URL=$REDIS_URL
|
||||
export CELERY_BROKER_URL=$CACHE_URL
|
||||
|
||||
# we copy the frontend files, if any so we can serve them from the outside
|
||||
if [ -d "frontend" ]; then
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ MANAGERS = ADMINS
|
|||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#databases
|
||||
DATABASES = {
|
||||
# Raises ImproperlyConfigured exception if DATABASE_URL not in os.environ
|
||||
'default': env.db("DATABASE_URL", default="postgresql://postgres@postgres/postgres"),
|
||||
'default': env.db("DATABASE_URL"),
|
||||
}
|
||||
DATABASES['default']['ATOMIC_REQUESTS'] = True
|
||||
#
|
||||
|
|
@ -198,7 +198,7 @@ CRISPY_TEMPLATE_PACK = 'bootstrap3'
|
|||
# STATIC FILE CONFIGURATION
|
||||
# ------------------------------------------------------------------------------
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#static-root
|
||||
STATIC_ROOT = str(ROOT_DIR('staticfiles'))
|
||||
STATIC_ROOT = env("STATIC_ROOT", default=str(ROOT_DIR('staticfiles')))
|
||||
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#static-url
|
||||
STATIC_URL = env("STATIC_URL", default='/staticfiles/')
|
||||
|
|
@ -217,12 +217,10 @@ STATICFILES_FINDERS = (
|
|||
# MEDIA CONFIGURATION
|
||||
# ------------------------------------------------------------------------------
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#media-root
|
||||
MEDIA_ROOT = str(APPS_DIR('media'))
|
||||
|
||||
|
||||
MEDIA_ROOT = env("MEDIA_ROOT", default=str(APPS_DIR('media')))
|
||||
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#media-url
|
||||
MEDIA_URL = '/media/'
|
||||
MEDIA_URL = env("MEDIA_URL", default='/media/')
|
||||
|
||||
# URL Configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
|
@ -252,26 +250,24 @@ LOGIN_URL = 'account_login'
|
|||
# SLUGLIFIER
|
||||
AUTOSLUG_SLUGIFY_FUNCTION = 'slugify.slugify'
|
||||
|
||||
########## CELERY
|
||||
INSTALLED_APPS += ('funkwhale_api.taskapp.celery.CeleryConfig',)
|
||||
# if you are not using the django database broker (e.g. rabbitmq, redis, memcached), you can remove the next line.
|
||||
INSTALLED_APPS += ('kombu.transport.django',)
|
||||
BROKER_URL = env("CELERY_BROKER_URL", default='django://')
|
||||
########## END CELERY
|
||||
|
||||
|
||||
CACHE_DEFAULT = "redis://127.0.0.1:6379/0"
|
||||
CACHES = {
|
||||
"default": {
|
||||
"BACKEND": "django_redis.cache.RedisCache",
|
||||
"LOCATION": "{0}/{1}".format(env.cache_url('REDIS_URL', default="redis://127.0.0.1:6379"), 0),
|
||||
"OPTIONS": {
|
||||
"CLIENT_CLASS": "django_redis.client.DefaultClient",
|
||||
"IGNORE_EXCEPTIONS": True, # mimics memcache behavior.
|
||||
# http://niwinz.github.io/django-redis/latest/#_memcached_exceptions_behavior
|
||||
}
|
||||
}
|
||||
"default": env.cache_url('CACHE_URL', default=CACHE_DEFAULT)
|
||||
}
|
||||
|
||||
CACHES["default"]["BACKEND"] = "django_redis.cache.RedisCache"
|
||||
CACHES["default"]["OPTIONS"] = {
|
||||
"CLIENT_CLASS": "django_redis.client.DefaultClient",
|
||||
"IGNORE_EXCEPTIONS": True, # mimics memcache behavior.
|
||||
# http://niwinz.github.io/django-redis/latest/#_memcached_exceptions_behavior
|
||||
}
|
||||
|
||||
|
||||
########## CELERY
|
||||
INSTALLED_APPS += ('funkwhale_api.taskapp.celery.CeleryConfig',)
|
||||
BROKER_URL = env(
|
||||
"CELERY_BROKER_URL", default=env('CACHE_URL', default=CACHE_DEFAULT))
|
||||
########## END CELERY
|
||||
# Location of root django.contrib.admin URL, use {% url 'admin:index' %}
|
||||
ADMIN_URL = r'^admin/'
|
||||
# Your common stuff: Below this line define 3rd party library settings
|
||||
|
|
@ -334,3 +330,7 @@ MUSICBRAINZ_CACHE_DURATION = env.int(
|
|||
)
|
||||
|
||||
CACHALOT_ENABLED = env.bool('CACHALOT_ENABLED', default=True)
|
||||
|
||||
|
||||
# Custom Admin URL, use {% url 'admin:index' %}
|
||||
ADMIN_URL = env('DJANGO_ADMIN_URL', default='^api/admin/')
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
|
|||
# ------------------------------------------------------------------------------
|
||||
# Hosts/domain names that are valid for this site
|
||||
# See https://docs.djangoproject.com/en/1.6/ref/settings/#allowed-hosts
|
||||
ALLOWED_HOSTS = env.list('DJANGO_ALLOWED_HOSTS', default=['funkwhale.io'])
|
||||
ALLOWED_HOSTS = env.list('DJANGO_ALLOWED_HOSTS')
|
||||
# END SITE CONFIGURATION
|
||||
|
||||
INSTALLED_APPS += ("gunicorn", )
|
||||
|
|
@ -65,10 +65,6 @@ INSTALLED_APPS += ("gunicorn", )
|
|||
# ------------------------
|
||||
DEFAULT_FILE_STORAGE = 'django.core.files.storage.FileSystemStorage'
|
||||
|
||||
# URL that handles the media served from MEDIA_ROOT, used for managing
|
||||
# stored files.
|
||||
MEDIA_URL = '/media/'
|
||||
|
||||
# Static Assets
|
||||
# ------------------------
|
||||
STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.StaticFilesStorage'
|
||||
|
|
@ -92,11 +88,6 @@ TEMPLATES[0]['OPTIONS']['loaders'] = [
|
|||
'django.template.loaders.filesystem.Loader', 'django.template.loaders.app_directories.Loader', ]),
|
||||
]
|
||||
|
||||
# DATABASE CONFIGURATION
|
||||
# ------------------------------------------------------------------------------
|
||||
# Raises ImproperlyConfigured exception if DATABASE_URL not in os.environ
|
||||
DATABASES['default'] = env.db("DATABASE_URL")
|
||||
|
||||
# CACHING
|
||||
# ------------------------------------------------------------------------------
|
||||
# Heroku URL does not pass the DB number, so we parse it in
|
||||
|
|
@ -151,7 +142,5 @@ LOGGING = {
|
|||
}
|
||||
}
|
||||
|
||||
# Custom Admin URL, use {% url 'admin:index' %}
|
||||
ADMIN_URL = env('DJANGO_ADMIN_URL')
|
||||
|
||||
# Your production stuff: Below this line define 3rd party library settings
|
||||
|
|
|
|||
|
|
@ -22,6 +22,9 @@ CACHES = {
|
|||
'LOCATION': ''
|
||||
}
|
||||
}
|
||||
INSTALLED_APPS += ('kombu.transport.django',)
|
||||
BROKER_URL = 'django://'
|
||||
|
||||
# TESTING
|
||||
# ------------------------------------------------------------------------------
|
||||
TEST_RUNNER = 'django.test.runner.DiscoverRunner'
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import glob
|
||||
from django.core.management.base import BaseCommand, CommandError
|
||||
from funkwhale_api.providers.audiofile import importer
|
||||
from funkwhale_api.providers.audiofile import tasks
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
|
|
@ -61,7 +61,7 @@ class Command(BaseCommand):
|
|||
for path in matching:
|
||||
self.stdout.write(message.format(path))
|
||||
try:
|
||||
importer.from_path(path)
|
||||
tasks.from_path(path)
|
||||
except Exception as e:
|
||||
self.stdout.write('Error: {}'.format(e))
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import datetime
|
|||
import unittest
|
||||
from test_plus.test import TestCase
|
||||
|
||||
from funkwhale_api.providers.audiofile import importer
|
||||
from funkwhale_api.providers.audiofile import tasks
|
||||
|
||||
DATA_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||
|
||||
|
|
@ -27,7 +27,7 @@ class TestAudioFile(TestCase):
|
|||
return_value='OggVorbis',
|
||||
)
|
||||
with m1, m2:
|
||||
track_file = importer.from_path(
|
||||
track_file = tasks.from_path(
|
||||
os.path.join(DATA_DIR, 'dummy_file.ogg'))
|
||||
|
||||
self.assertEqual(
|
||||
|
|
|
|||
|
|
@ -2,8 +2,11 @@
|
|||
import os
|
||||
import sys
|
||||
|
||||
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
|
||||
|
||||
if __name__ == "__main__":
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.local")
|
||||
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.production")
|
||||
|
||||
from django.core.management import execute_from_command_line
|
||||
|
||||
|
|
|
|||
|
|
@ -1,46 +1,9 @@
|
|||
##basic build dependencies of various Django apps for Ubuntu 14.04
|
||||
#build-essential metapackage install: make, gcc, g++,
|
||||
build-essential
|
||||
#required to translate
|
||||
gettext
|
||||
#python-dev
|
||||
|
||||
##shared dependencies of:
|
||||
##Pillow, pylibmc
|
||||
zlib1g-dev
|
||||
|
||||
##Postgresql and psycopg2 dependencies
|
||||
libjpeg-dev
|
||||
zlib1g-dev
|
||||
libpq-dev
|
||||
postgresql-client
|
||||
##Pillow dependencies
|
||||
#libtiff4-dev
|
||||
#libjpeg8-dev
|
||||
#libfreetype6-dev
|
||||
#liblcms1-dev
|
||||
#libwebp-dev
|
||||
|
||||
|
||||
##django-extensions
|
||||
#graphviz-dev
|
||||
|
||||
##hitch
|
||||
#python-setuptools
|
||||
#python3-dev
|
||||
#python-virtualenv
|
||||
#python-pip
|
||||
#firefox
|
||||
#automake
|
||||
#libtool
|
||||
#libreadline6
|
||||
#libreadline6-dev
|
||||
#libreadline-dev
|
||||
libsqlite3-dev
|
||||
#libxml2
|
||||
#libxml2-dev
|
||||
#libssl-dev
|
||||
#libbz2-dev
|
||||
#wget
|
||||
#curl
|
||||
#llvm
|
||||
|
||||
libav-tools
|
||||
python3-dev
|
||||
|
|
|
|||
|
|
@ -4,3 +4,5 @@ test:
|
|||
command: pytest
|
||||
volumes:
|
||||
- .:/app
|
||||
environment:
|
||||
- "DATABASE_URL=sqlite://"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue