-
Notifications
You must be signed in to change notification settings - Fork 2
Home
Welcome to the photomanager wiki!
This wiki is a work in progress (well, the entire project is). Definitely not ready for production usage.
WARNING: This is not ready for production usage. If you want to deploy in production, that's on you. (Well, regardless of production-ready status, everything is on you regardless.)
The only supported deployment method is Docker deployment.
You will need:
- Docker installed
- A Nextcloud instance
-
Clone this repository. Alternatively, you can just download
docker-compose.yml
, and change the mount forsecret.py
accordingly. -
Modify
docker-compose.yml
as follows:-
Change
POSTGRES_PASSWORD
in thepostgres
container definition to a secure password. -
Change the mount for
/data
in thephotomanager
container definition to your Nextcloud instance's data directory. You may want to make this mount read-only.For instance:
- /docker/nextcloud/data:/data:ro
or
- /var/www/nextcloud/data:/data:ro
Your source directory depends on your specific setup.
-
-
Copy
photomanager/settings/secret.sample.py
tophotomanager/settings/secret.py
and enter your settings as follows:-
SECRET_KEY
: the Django secret key, as described here. You could generate one usingfrom django.core.management.utils import get_random_secret_key print(get_random_secret_key())
-
DEBUG
: Set toFalse
in production. -
ALLOWED_HOSTS
: You will need to add a list of hostnames where thisphotomanager
instance can be accessed here.Example:
ALLOWED_HOSTS = ["photomanager.example.com"]
-
SOCIAL_AUTH_REDIRECT_IS_HTTPS
: If you are running this behind a reverse proxy and you are using HTTPS, set this toTrue
. -
SOCIAL_AUTH_NEXTCLOUD_KEY
andSOCIAL_AUTH_NEXTCLOUD_SECRET
: Create an OAuth2 application in your Nextcloud instance, as described here, then place your client identifier and secret in these variables respectively. The redirect URL ishttp[s]://[HOST]/complete/nextcloud
. -
NEXTCLOUD_URI
is the hostname (not the URL) of your Nextcloud instance, and it is used when redirecting a user to Nextcloud for authentication.Example:
NEXTCLOUD_URI = "nextcloud.example.com"
-
DATABASES
should be:DATABASES = { "default": { "ENGINE": "django.db.backends.postgresql_psycopg2", "NAME": "photomanager", "USER": "photomanager", "PASSWORD": "{{ ENTER YOUR POSTGRES PASSWORD HERE }}", # Database password "HOST": "postgres", "PORT": "5432", } }
-
CACHES
should be:CACHES = { "default": { "BACKEND": "django_redis.cache.RedisCache", "LOCATION": "redis://redis:6379/1", "OPTIONS": { "CLIENT_CLASS": "django_redis.client.DefaultClient", }, } }
-
-
docker-compose up -d
To be written. (However, it's pretty similar to the non-Swarm deployment.)
-
You want to have Vagrant installed.
-
You also need Virtualbox.
-
You need a Nextcloud instance for authentication. You may be able to get away with adding the following to
secret.py
(see below):AUTHENTICATION_BACKENDS += ['django.contrib.auth.backends.ModelBackend']
and then using
pipenv run ./manage.py createsuperuser
to create a user, and authenticating using the Django administration login (localhost:8000/admin
).
Clone this repository.
You will then need to copy photomanager/settings/secret.sample.py
to photomanager/settings/secret.py
, and change the settings in there as follows:
-
SECRET_KEY
: the Django secret key, as described here. You could generate one usingfrom django.core.management.utils import get_random_secret_key print(get_random_secret_key())
-
DEBUG
: Set toFalse
in production,True
in development. See this. -
ALLOWED_HOSTS
: IfDEBUG
isFalse
, then you will need to add a list of hosts where thisphotomanager
instance can be accessed here. -
SOCIAL_AUTH_REDIRECT_IS_HTTPS
: If you are running this behind a reverse proxy and you are using HTTPS, set this toTrue
. -
SOCIAL_AUTH_NEXTCLOUD_KEY
andSOCIAL_AUTH_NEXTCLOUD_SECRET
: Create an OAuth2 application in your Nextcloud instance, as described here, then place your client identifier and secret in these variables respectively. The redirect URL ishttp[s]://[HOST]/complete/nextcloud
. -
NEXTCLOUD_URI
is the hostname of your Nextcloud instance, and it is used when redirecting a user to Nextcloud for authentication.
Then run
vagrant up
in the root directory. Vagrant will take care of the rest of the provisioning.
Then, to get a shell inside your virtual machine that Vagrant just provisioned, run
vagrant ssh
Then, within this shell, to start the development servers, run
/home/vagrant/photomanager/scripts/install_dependencies.sh
/home/vagrant/photomanager/scripts/start_servers.sh
The first script installs dependencies twice: one time as the vagrant
user, and a second time as the root
user.
The second script starts a tmux
session with celery -A photomanager worker -l DEBUG
, pipenv run celery -A photomanager beat -l DEBUG
, and ./manage.py runserver 0.0.0.0:8000
.
Point your browser to localhost:8000
to access photomanager
.
You will need to do something like this (pipenv run ./manage.py shell_plus
to get a Django shell) to make your user an admin:
user = User.objects.get(username='[USERNAME - your Nextcloud username]')
user.is_superuser = True
user.is_staff = True
user.save()