-
Notifications
You must be signed in to change notification settings - Fork 7
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
Setup update and API Token Authentication #137
Conversation
Attempting to apply migration before its dependency
openstuttgart's feinstaub sensors app is taken care of by pip git repo install
Affects data and now endpoints
Prevents error with SSL certificate
Limit URLLIB3 to version 1 to resolve conflict with Sentry SDK
Read replica db no longer in use
The migrations files in the sensorsafrica directory will resolve the migration issues and prompt removal of pip installing opendata-stuttgart master feinstaub-api
7dc2883
to
b43c815
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏽
If I understand what we're trying to do, then I see this as breaking change i.e. the new secure endpoints are no longer v1 but v2 (or whatever v we're currently on).
My approach would be:
- Create new v2 endpoints that work exactly like the equivalent v1 endpoints but secure.
- Test and deploy backend to PROD.
- Upgrade the front-end up to point to v2 endpoints.
- Test and deploy front-end to PROD.
- Remove or redirect unsecure v1 endpoints.
- Test and deploy backend to PROD.
- Profit
# Upgrade pip from trusted hosts | ||
RUN python -m pip install --trusted-host pypi.python.org --trusted-host files.pythonhosted.org --trusted-host pypi.org --upgrade pip | ||
|
||
# Upgrade pip and setuptools | ||
RUN pip install -q -U pip setuptools |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why 2 ways of upgrading pip
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏽 the upgrade flag will be removed to just install the setup tools
username: `sensorsafrica` | ||
email: blank | ||
password: `sensorsafrica` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Must username/password be sensorsafrica
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really. Let's say it a convention. Any thoughts?
@@ -2,15 +2,20 @@ version: '3.3' | |||
|
|||
services: | |||
rabbitmq: | |||
image: rabbitmq:3.5.1 | |||
image: rabbitmq:3.12.7-management |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is 3.12 the version used in PROD as well?
SENSORSAFRICA_DATABASE_URL: ${SENSORSAFRICA_DATABASE_URL} | ||
SENSORSAFRICA_RABBITMQ_URL: ${SENSORSAFRICA_RABBITMQ_URL} | ||
SENSORSAFRICA_FLOWER_ADMIN_USERNAME: ${SENSORSAFRICA_FLOWER_ADMIN_USERNAME} | ||
SENSORSAFRICA_FLOWER_ADMIN_PASSWORD: ${SENSORSAFRICA_FLOWER_ADMIN_PASSWORD} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a default for any of these?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was previously.
SENSORSAFRICA_DATABASE_URL: postgres://sensorsafrica:sensorsafrica@postgres:5432/sensorsafrica
SENSORSAFRICA_RABBITMQ_URL: amqp://sensorsafrica:sensorsafrica@rabbitmq:5672
SENSORSAFRICA_FLOWER_ADMIN_USERNAME: admin
SENSORSAFRICA_FLOWER_ADMIN_PASSWORD: password```
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will be updated in the README for local setup.
for index, read_database_url in enumerate(READ_DATABASE_URLS,start=1): | ||
DATABASES[f"read_replica_{index}"] = dj_database_url.parse(read_database_url) | ||
|
||
DATABASE_ROUTERS = ["sensorsafrica.router.ReplicaRouter", ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏽
Cool, makes sense @gideonmaina I'll setup a review to plan for this implementation approach |
PS: Not sure what |
Description
The main aim of this PR is to simplify local development and implement authentication for key endpoints prone to bot crawling or misuse by clients whilst fixing a few issues related to dependencies and migrations. The affected endpoints/views in API
v1
aredata
,now
andnode
. This will attempt to reduce the lag observed when making calls to the API.Fixes issues #134, #135, #136
Setup changes
feinstaub sensors app
was removed from the working tree as pip install takes care of that.*04
in sensorsafrica app was removed as it is applied before a dependencyTests for these changes were both done using local and staging databases.
Type of change
Screenshots
Checklist: