Add more configuration options for redis
- `REDIS_HOST` can be specified in the secrets - Two new secrets: `REDIS_PASSWD` and `REDIS_DB`
This commit is contained in:
parent
a0fe94e2f4
commit
2aee43e01a
3 changed files with 14 additions and 7 deletions
|
@ -22,7 +22,8 @@ except KeyError:
|
|||
# Other secrets
|
||||
try:
|
||||
from .secret import (
|
||||
SECRET_KEY, RECAPTCHA_PUBLIC_KEY, RECAPTCHA_PRIVATE_KEY, ADMINS
|
||||
SECRET_KEY, RECAPTCHA_PUBLIC_KEY, RECAPTCHA_PRIVATE_KEY, ADMINS,
|
||||
REDIS_PASSWD, REDIS_DB, REDIS_HOST
|
||||
)
|
||||
except ImportError:
|
||||
raise RuntimeError("Secrets missing")
|
||||
|
@ -159,7 +160,10 @@ CHANNEL_LAYERS = {
|
|||
"default": {
|
||||
"BACKEND": "asgi_redis.RedisChannelLayer",
|
||||
"CONFIG": {
|
||||
"hosts": [(os.environ.get("REDIS_HOST", "localhost"), 6379)],
|
||||
"hosts": [(
|
||||
"redis://:{}@{}:6379/{}"
|
||||
.format(REDIS_PASSWD, REDIS_HOST, REDIS_DB)
|
||||
)],
|
||||
},
|
||||
"ROUTING": "cof.routing.channel_routing",
|
||||
}
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
SECRET_KEY = 'q()(zn4m63i%5cp4)f+ww4-28_w+ly3q9=6imw2ciu&_(5_4ah'
|
||||
RECAPTCHA_PUBLIC_KEY = "DUMMY"
|
||||
RECAPTCHA_PRIVATE_KEY = "DUMMY"
|
||||
REDIS_PASSWD = "dummy"
|
||||
REDIS_DB = 0
|
||||
REDIS_HOST = "127.0.0.1"
|
||||
ADMINS = None
|
||||
|
|
|
@ -23,6 +23,9 @@ apt-get install -y mysql-server
|
|||
mysql -uroot -p$DBPASSWD -e "CREATE DATABASE $DBNAME; GRANT ALL PRIVILEGES ON $DBNAME.* TO '$DBUSER'@'localhost' IDENTIFIED BY '$DBPASSWD'"
|
||||
mysql -uroot -p$DBPASSWD -e "GRANT ALL PRIVILEGES ON test_$DBNAME.* TO '$DBUSER'@'localhost'"
|
||||
|
||||
# Configuration de redis
|
||||
echo "requirepass dummy" >> /etc/redis/redis.conf
|
||||
|
||||
# Installation et configuration d'Apache
|
||||
apt-get install -y apache2
|
||||
a2enmod proxy proxy_http proxy_wstunnel headers
|
||||
|
@ -36,7 +39,7 @@ chown -R ubuntu:www-data /var/www/static
|
|||
# Mise en place du .bash_profile pour tout configurer lors du `vagrant ssh`
|
||||
cat >> ~ubuntu/.bashrc <<EOF
|
||||
# On utilise la version de développement de GestioCOF
|
||||
export DJANGO_SETTINGS_MODULE='cof.settings.dev'
|
||||
export DJANGO_SETTINGS_MODULE='gestioCOF.settings_dev'
|
||||
|
||||
# Identifiants MySQL
|
||||
export DBUSER="$DBUSER"
|
||||
|
@ -61,11 +64,8 @@ sudo -H -u ubuntu python3 -m venv ~ubuntu/venv
|
|||
sudo -H -u ubuntu ~ubuntu/venv/bin/pip install -U pip
|
||||
sudo -H -u ubuntu ~ubuntu/venv/bin/pip install -r requirements.txt -r requirements-devel.txt
|
||||
|
||||
# Installation des secrets
|
||||
sudo -H -u ubuntu cp cof/settings/secret_example.py cof/settings/secret.py
|
||||
|
||||
# Préparation de Django
|
||||
sudo -H -u ubuntu DJANGO_SETTINGS_MODULE='cof.settings.dev' DBUSER=$DBUSER DBNAME=$DBNAME DBPASSWD=$DBPASSWD bash provisioning/prepare_django.sh
|
||||
sudo -H -u ubuntu DJANGO_SETTINGS_MODULE='gestioCOF.settings_dev' DBUSER=$DBUSER DBNAME=$DBNAME DBPASSWD=$DBPASSWD bash provisioning/prepare_django.sh
|
||||
|
||||
# Installation du cron pour les mails de rappels
|
||||
sudo -H -u ubuntu crontab provisioning/cron.dev
|
||||
|
|
Loading…
Reference in a new issue