ara
ara copied to clipboard
ARA_ENV doesn't work to select settings.yaml environment
What is the issue ?
I run latest api-server container with podman and it ignores config file.
I create the container with ansible
- name: copy config file
copy:
src: settings.yaml
dest: ~/.ara/server/
- name: run ara
containers.podman.podman_container:
name: api-server
state: present
image: docker.io/recordsansible/ara-api:latest
ports:
- "8000:8000"
volume:
- /root/.ara/server:/opt/ara:z
Then
root@tspeda-ara:~# podman logs api-server
[ara] No setting found for SECRET_KEY. Generating a random key...
[ara] Using settings file: /opt/ara/settings.yaml
Operations to perform:
Apply all migrations: admin, api, auth, contenttypes, db, sessions
Running migrations:
No migrations to apply.
[2020-12-14 09:16:38 +0000] [1] [INFO] Starting gunicorn 20.0.4
[2020-12-14 09:16:38 +0000] [1] [INFO] Listening at: http://0.0.0.0:8000 (1)
[2020-12-14 09:16:38 +0000] [1] [INFO] Using worker: sync
[2020-12-14 09:16:38 +0000] [7] [INFO] Booting worker with pid: 7
[2020-12-14 09:16:38 +0000] [8] [INFO] Booting worker with pid: 8
[2020-12-14 09:16:38 +0000] [9] [INFO] Booting worker with pid: 9
[2020-12-14 09:16:38 +0000] [10] [INFO] Booting worker with pid: 10
[ara] No setting found for SECRET_KEY. Generating a random key...
[ara] No setting found for SECRET_KEY. Generating a random key...
[ara] No setting found for SECRET_KEY. Generating a random key...
[ara] No setting found for SECRET_KEY. Generating a random key...
root@tspeda-ara:~# podman exec -it api-server cat /opt/ara/settings.yaml | grep SECRET
SECRET_KEY: aiyoed7W156xpz23g
root@tspeda-ara:~# podman exec -it api-server env
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
TERM=xterm
container=oci
DISTTAG=f33container
FGC=f33
ARA_BASE_DIR=/opt/ara
HOSTNAME=
HOME=/root
config file
ALLOWED_HOSTS:
- api.domain.fr
#READ_LOGIN_REQUIRED: true
#WRITE_LOGIN_REQUIRED: true
SECRET_KEY: ****************
if i move the config uder default
key it works
---
default:
ALLOWED_HOSTS:
- api.domain.fr
SECRET_KEY: ****************
But then if i use test
instead of default
and pass ARA_ENV: test
, i face the same issue
---
test:
ALLOWED_HOSTS:
- api.domain.fr
SECRET_KEY: ****************
- name: run ara
containers.podman.podman_container:
name: api-server
state: present
image: docker.io/recordsansible/ara-api:latest
ports:
- "8000:8000"
volume:
- /root/.ara/server:/opt/ara:z
env:
ARA_ENV: test