Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue/django setup configuration tokens #135

Merged
merged 63 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from 44 commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
63440e4
[maykinmedia/objects-api#481] Fix requirements
danielmursa-dev Dec 3, 2024
00ec96b
[maykinmedia/objects-api#481] Move config folder in setup_configuration
danielmursa-dev Dec 5, 2024
5834a29
[maykinmedia/objects-api#481] Config in settings
danielmursa-dev Dec 5, 2024
1e76cc2
[maykinmedia/objects-api#481] Update model with migrations
danielmursa-dev Dec 5, 2024
d159b34
[maykinmedia/objects-api#481] Black
danielmursa-dev Dec 5, 2024
ce9141b
[maykinmedia/objects-api#481] Create test_authenticaton tests
danielmursa-dev Dec 6, 2024
9d9b1c9
[maykinmedia/objects-api#481] Create test_validators
danielmursa-dev Dec 6, 2024
8fab4bc
[maykinmedia/objects-api#481] Fix models and migrations
danielmursa-dev Dec 6, 2024
694c41d
[maykinmedia/objects-api#481] Fix tests
danielmursa-dev Dec 6, 2024
0fc8ef9
[maykinmedia/objects-api#481] Delete utils
danielmursa-dev Dec 6, 2024
b596a13
[maykinmedia/objects-api#481] Add factory
danielmursa-dev Dec 6, 2024
6b6ef91
[maykinmedia/objects-api#481] Create step and model
danielmursa-dev Dec 6, 2024
bae8e82
[maykinmedia/objects-api#481] Create tests
danielmursa-dev Dec 6, 2024
952b2b2
[maykinmedia/objects-api#481] Fix old tests
danielmursa-dev Dec 9, 2024
b94ee29
[maykinmedia/objects-api#481] Update command line
danielmursa-dev Dec 9, 2024
55939bc
[maykinmedia/objects-api#481] Remove old settings
danielmursa-dev Dec 9, 2024
53fadd8
[maykinmedia/objects-api#481] Add configuration file for docker
danielmursa-dev Dec 9, 2024
0ec85d8
[maykinmedia/objects-api#481] Fix docker-compose
danielmursa-dev Dec 9, 2024
350b5ff
[maykinmedia/objects-api#481] Flake8
danielmursa-dev Dec 9, 2024
0c84097
[maykinmedia/objects-api#481] Create command tests and delete old tests
danielmursa-dev Dec 9, 2024
dd87a63
[maykinmedia/objects-api#481] Fix setup_configuration
danielmursa-dev Dec 9, 2024
050db03
[maykinmedia/objects-api#481] Fix requirements
danielmursa-dev Dec 9, 2024
3bd76ac
[maykinmedia/objects-api#481] Fix requirements
danielmursa-dev Dec 10, 2024
d1fdcaa
[maykinmedia/objects-api#481] Fix data.yaml
danielmursa-dev Dec 10, 2024
8858b43
[maykinmedia/objects-api#481] Fix base settings
danielmursa-dev Dec 10, 2024
c1f1363
[maykinmedia/objects-api#481] Fix docker-compose file
danielmursa-dev Dec 10, 2024
2384ffa
[maykinmedia/objects-api#481] Replace build_step_config_from_sources …
danielmursa-dev Dec 10, 2024
25f9962
[maykinmedia/objects-api#481] Fix Sites tests
danielmursa-dev Dec 10, 2024
96eb623
[maykinmedia/objects-api#481] Improve Site tests
danielmursa-dev Dec 10, 2024
5da131b
[maykinmedia/objects-api#481] Improve Token tests
danielmursa-dev Dec 10, 2024
997025e
[maykinmedia/objects-api#481] Black
danielmursa-dev Dec 10, 2024
7f19b9c
[maykinmedia/objects-api#481] Add test for empty token
danielmursa-dev Dec 10, 2024
144b593
[maykinmedia/objects-api#481] Copy migration test
danielmursa-dev Dec 10, 2024
fad2567
[maykinmedia/objects-api#481] Fix migration tests
danielmursa-dev Dec 10, 2024
ee56909
[maykinmedia/objects-api#481] Fix django-setup-configuration version …
danielmursa-dev Dec 10, 2024
f6c3a1e
[maykinmedia/objects-api#481] Fix docstring
danielmursa-dev Dec 10, 2024
a8bc41e
[maykinmedia/objects-api#481] Change file_name
danielmursa-dev Dec 10, 2024
3ca644e
[maykinmedia/objects-api#481] Fix name objecttypes_sites_config_enable
danielmursa-dev Dec 10, 2024
00d09ba
[maykinmedia/objects-api#481] Fix name objecttypes_sites_config_enable 2
danielmursa-dev Dec 10, 2024
b71db8e
[maykinmedia/objects-api#481] Remove tests for call_command
danielmursa-dev Dec 10, 2024
97e6277
[maykinmedia/objects-api#481] Change env variables in docker-compose
danielmursa-dev Dec 11, 2024
7145b30
[maykinmedia/objects-api#481] Split in directories
danielmursa-dev Dec 11, 2024
dce654e
[maykinmedia/objects-api#481] Fix paths
danielmursa-dev Dec 11, 2024
41818ca
[maykinmedia/objects-api#481] Update name for SitesConfiguration
danielmursa-dev Dec 11, 2024
dfc50cd
[maykinmedia/objects-api#481] Update namespace for Site
danielmursa-dev Dec 11, 2024
443b9da
[maykinmedia/objects-api#481] Update namespace for TokenAuthConfigura…
danielmursa-dev Dec 11, 2024
bf963a6
[maykinmedia/objects-api#481] Remove Field from ConfigurationModel
danielmursa-dev Dec 11, 2024
579f6ef
[maykinmedia/objects-api#481] Update INSTALL.rst
danielmursa-dev Dec 11, 2024
715684f
[maykinmedia/objects-api#481] Fix tests
danielmursa-dev Dec 12, 2024
58f90b0
[maykinmedia/objects-api#481] Remove unnecessary volumes in docker
danielmursa-dev Dec 12, 2024
b9c2fc4
[maykinmedia/objects-api#481] Change namespace
danielmursa-dev Dec 12, 2024
975e0ab
[maykinmedia/objects-api#481] Change namespace in file
danielmursa-dev Dec 12, 2024
a2c9c59
[maykinmedia/objects-api#481] Change namespace zgw_tokens_tokenauth
danielmursa-dev Dec 12, 2024
a757ed4
Revert "[maykinmedia/objects-api#481] Change namespace zgw_tokens_tok…
danielmursa-dev Dec 12, 2024
a6dd40c
[maykinmedia/objects-api#481] Fix unnecessary "loop" for one element
danielmursa-dev Dec 12, 2024
7f11929
[maykinmedia/objects-api#481] Fix INSTALL.rst
danielmursa-dev Dec 13, 2024
ea89539
[maykinmedia/objects-api#481] Add link to repo in INSTALL.rst
danielmursa-dev Dec 13, 2024
3310deb
[maykinmedia/objects-api#481] Fix token tests
danielmursa-dev Dec 13, 2024
fd26732
[maykinmedia/objects-api#481] Change name validate_no_whitespace
danielmursa-dev Dec 13, 2024
dcecf53
[maykinmedia/objects-api#481] Remove unused validation control
danielmursa-dev Dec 13, 2024
f3f44d2
[maykinmedia/objects-api#481] Black
danielmursa-dev Dec 13, 2024
18ec10e
[maykinmedia/objects-api#481] Add warning if list is empty
danielmursa-dev Dec 13, 2024
d6df41a
[maykinmedia/objects-api#481] Add validate_no_empty + tests
danielmursa-dev Dec 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions bin/setup_configuration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@
# setup initial configuration using environment variables
# Run this script from the root of the repository

#set -e
${SCRIPTPATH}/wait_for_db.sh
set -e

src/manage.py migrate
if [[ "${RUN_SETUP_CONFIG,,}" =~ ^(true|1|yes)$ ]]; then
# wait for required services
${SCRIPTPATH}/wait_for_db.sh

src/manage.py setup_configuration --no-selftest
src/manage.py migrate
src/manage.py setup_configuration --yaml-file setup_configuration/data.yaml
fi
52 changes: 30 additions & 22 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ services:
db:
image: postgres:12-alpine
environment:
- POSTGRES_USER=objecttypes
- POSTGRES_PASSWORD=objecttypes
POSTGRES_USER: objecttypes
POSTGRES_PASSWORD: objecttypes
command: postgres -c max_connections=300 -c log_min_messages=LOG

redis:
Expand All @@ -13,33 +13,41 @@ services:
image: maykinmedia/objecttypes-api:latest
build: .
environment: &app-env
- DB_USER=objecttypes
- DB_PASSWORD=objecttypes
- DJANGO_SETTINGS_MODULE=objecttypes.conf.docker
- SECRET_KEY=${SECRET_KEY:-fgv=c0hz&tl*8*3m3893@m+1pstrvidc9e^5@fpspmg%cyf15d}
- ALLOWED_HOSTS=*
- CACHE_DEFAULT=redis:6379/0
- CACHE_AXES=redis:6379/0
- DISABLE_2FA=yes
- SUBPATH=${SUBPATH:-/}
# setup_configuration env vars
- SITES_CONFIG_ENABLE=yes
- OBJECTTYPES_DOMAIN=web:8000
- OBJECTTYPES_ORGANIZATION=ObjectTypes
- OBJECTS_OBJECTTYPES_CONFIG_ENABLE=yes
- OBJECTS_OBJECTTYPES_TOKEN=some-random-string
- OBJECTS_OBJECTTYPES_PERSON=Some Person
- [email protected]
DB_USER: objecttypes
DB_PASSWORD: objecttypes
DJANGO_SETTINGS_MODULE: objecttypes.conf.docker
SECRET_KEY: ${SECRET_KEY:-fgv=c0hz&tl*8*3m3893@m+1pstrvidc9e^5@fpspmg%cyf15d}
ALLOWED_HOSTS: '*'
CACHE_DEFAULT: redis:6379/0
CACHE_AXES: redis:6379/0
DISABLE_2FA: yes
SUBPATH: ${SUBPATH:-/}
volumes:
- media:/app/media
- private_media:/app/private_media
danielmursa-dev marked this conversation as resolved.
Show resolved Hide resolved
- log:/app/log
ports:
- 8000:8000
depends_on:
web-init:
condition: service_completed_successfully

web-init:
image: maykinmedia/objecttypes-api:latest
build: .
environment: *app-env
environment:
<<: *app-env
#
# Django-setup-configuration
RUN_SETUP_CONFIG: ${RUN_SETUP_CONFIG:-true}
command: /setup_configuration.sh
volumes:
- log:/app/log
- ./docker/setup_configuration:/app/setup_configuration
depends_on:
- db
- db

volumes:
db:
log:
media:
private_media:
16 changes: 16 additions & 0 deletions docker/setup_configuration/data.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
objecttypes_tokens_config_enable: true
objecttypes_tokens:
items:
- identifier: token-1
token: 18b2b74ef994314b84021d47b9422e82b685d82f
contact_person: Person 1
email: [email protected]
organization: Organization 1
application: Application 1
administration: Administration 1

objecttypes_sites_config_enable: true
objecttypes_sites:
items:
- domain: example.com
name: example
2 changes: 1 addition & 1 deletion requirements/base.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ furl
# Framework libraries
django-jsonsuit
sharing-configs
django-setup-configuration
django-setup-configuration>=0.4.0

# API libraries
drf-nested-routers
25 changes: 19 additions & 6 deletions requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#
amqp==5.1.1
# via kombu
annotated-types==0.7.0
# via pydantic
ape-pie==0.1.0
# via
# commonground-api-common
Expand Down Expand Up @@ -154,7 +156,7 @@ django-sendfile2==0.7.0
# via django-privates
django-sessionprofile==3.0.0
# via open-api-framework
django-setup-configuration==0.1.0
django-setup-configuration==0.4.0
danielmursa-dev marked this conversation as resolved.
Show resolved Hide resolved
# via
# -r requirements/base.in
# open-api-framework
Expand Down Expand Up @@ -193,9 +195,7 @@ drf-nested-routers==0.94.1
# -r requirements/base.in
# commonground-api-common
drf-spectacular[sidecar]==0.27.2
# via
# drf-spectacular
# open-api-framework
# via open-api-framework
drf-spectacular-sidecar==2024.7.1
# via drf-spectacular
drf-yasg==1.21.7
Expand Down Expand Up @@ -266,6 +266,14 @@ psycopg2==2.9.9
# via open-api-framework
pycparser==2.21
# via cffi
pydantic==2.9.2
# via
# django-setup-configuration
# pydantic-settings
pydantic-core==2.23.4
# via pydantic
pydantic-settings[yaml]==2.6.1
# via django-setup-configuration
pyjwt==2.7.0
# via
# commonground-api-common
Expand All @@ -283,16 +291,19 @@ python-dateutil==2.8.2
python-decouple==3.8
# via open-api-framework
python-dotenv==1.0.0
# via open-api-framework
# via
# open-api-framework
# pydantic-settings
pytz==2023.3
# via
# drf-yasg
# flower
pyyaml==6.0
pyyaml==6.0.2
# via
# drf-spectacular
# drf-yasg
# oyaml
# pydantic-settings
qrcode==6.1
# via django-two-factor-auth
redis==4.5.5
Expand Down Expand Up @@ -330,6 +341,8 @@ tornado==6.4.1
typing-extensions==4.11.0
# via
# mozilla-django-oidc-db
# pydantic
# pydantic-core
# zgw-consumers
tzdata==2024.1
# via celery
Expand Down
27 changes: 23 additions & 4 deletions requirements/ci.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ amqp==5.1.1
# via
# -r requirements/base.txt
# kombu
annotated-types==0.7.0
# via
# -r requirements/base.txt
# pydantic
ape-pie==0.1.0
# via
# -r requirements/base.txt
Expand Down Expand Up @@ -238,7 +242,7 @@ django-sessionprofile==3.0.0
# via
# -r requirements/base.txt
# open-api-framework
django-setup-configuration==0.1.0
django-setup-configuration==0.4.0
# via
# -r requirements/base.txt
# open-api-framework
Expand All @@ -258,7 +262,6 @@ django-solo==2.0.0
django-two-factor-auth[phonenumberslite,webauthn]==1.16.0
# via
# -r requirements/base.txt
# django-two-factor-auth
# maykin-2fa
django-webtest==1.9.10
# via -r requirements/test-tools.in
Expand Down Expand Up @@ -293,7 +296,6 @@ drf-nested-routers==0.94.1
drf-spectacular[sidecar]==0.27.2
# via
# -r requirements/base.txt
# drf-spectacular
# open-api-framework
drf-spectacular-sidecar==2024.7.1
# via
Expand Down Expand Up @@ -448,6 +450,19 @@ pycparser==2.21
# via
# -r requirements/base.txt
# cffi
pydantic==2.9.2
# via
# -r requirements/base.txt
# django-setup-configuration
# pydantic-settings
pydantic-core==2.23.4
# via
# -r requirements/base.txt
# pydantic
pydantic-settings[yaml]==2.6.1
# via
# -r requirements/base.txt
# django-setup-configuration
pyflakes==3.2.0
# via flake8
pyjwt==2.7.0
Expand Down Expand Up @@ -481,17 +496,19 @@ python-dotenv==1.0.0
# via
# -r requirements/base.txt
# open-api-framework
# pydantic-settings
pytz==2023.3
# via
# -r requirements/base.txt
# drf-yasg
# flower
pyyaml==6.0
pyyaml==6.0.2
# via
# -r requirements/base.txt
# drf-spectacular
# drf-yasg
# oyaml
# pydantic-settings
# vcrpy
qrcode==6.1
# via
Expand Down Expand Up @@ -551,6 +568,8 @@ typing-extensions==4.11.0
# via
# -r requirements/base.txt
# mozilla-django-oidc-db
# pydantic
# pydantic-core
# zgw-consumers
tzdata==2024.1
# via
Expand Down
27 changes: 23 additions & 4 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ amqp==5.1.1
# via
# -r requirements/base.txt
# kombu
annotated-types==0.7.0
# via
# -r requirements/base.txt
# pydantic
ape-pie==0.1.0
# via
# -r requirements/base.txt
Expand Down Expand Up @@ -249,7 +253,7 @@ django-sessionprofile==3.0.0
# via
# -r requirements/base.txt
# open-api-framework
django-setup-configuration==0.1.0
django-setup-configuration==0.4.0
# via
# -r requirements/base.txt
# open-api-framework
Expand All @@ -269,7 +273,6 @@ django-solo==2.0.0
django-two-factor-auth[phonenumberslite,webauthn]==1.16.0
# via
# -r requirements/base.txt
# django-two-factor-auth
# maykin-2fa
django-webtest==1.9.10
# via -r requirements/test-tools.in
Expand Down Expand Up @@ -308,7 +311,6 @@ drf-nested-routers==0.94.1
drf-spectacular[sidecar]==0.27.2
# via
# -r requirements/base.txt
# drf-spectacular
# open-api-framework
drf-spectacular-sidecar==2024.7.1
# via
Expand Down Expand Up @@ -470,6 +472,19 @@ pycparser==2.21
# via
# -r requirements/base.txt
# cffi
pydantic==2.9.2
# via
# -r requirements/base.txt
# django-setup-configuration
# pydantic-settings
pydantic-core==2.23.4
# via
# -r requirements/base.txt
# pydantic
pydantic-settings[yaml]==2.6.1
# via
# -r requirements/base.txt
# django-setup-configuration
pyflakes==3.0.1
# via flake8
pygments==2.15.1
Expand Down Expand Up @@ -507,17 +522,19 @@ python-dotenv==1.0.0
# via
# -r requirements/base.txt
# open-api-framework
# pydantic-settings
pytz==2023.3
# via
# -r requirements/base.txt
# drf-yasg
# flower
pyyaml==6.0
pyyaml==6.0.2
# via
# -r requirements/base.txt
# drf-spectacular
# drf-yasg
# oyaml
# pydantic-settings
# vcrpy
qrcode==6.1
# via
Expand Down Expand Up @@ -601,6 +618,8 @@ typing-extensions==4.11.0
# via
# -r requirements/base.txt
# mozilla-django-oidc-db
# pydantic
# pydantic-core
# zgw-consumers
tzdata==2024.1
# via
Expand Down
Loading
Loading