Commit 6a83a6ee authored by Markus Scheidgen's avatar Markus Scheidgen
Browse files

Adopted ops to MP tests and latest app changes.

parent 759e8d2c
......@@ -125,11 +125,14 @@ class User(Base): # type: ignore
def from_user_id(user_id) -> 'User':
return infrastructure.repository_db.query(User).get(user_id)
def get_auth_token(self):
def get_auth_token(self, create=True):
repo_db = infrastructure.repository_db
session = repo_db.query(Session).filter_by(user_id=self.user_id).first()
if not session:
if not create:
return None
repo_db.begin()
try:
# TODO this has to change, e.g. trade for JWTs
......
......@@ -1067,10 +1067,9 @@ class NomadCOEMigration:
created=source_user.created
)
try:
create_user_payload.update(token=source_user.token)
except LoginException:
pass
token = source_user.get_auth_token(create=False)
if token is not None:
create_user_payload.update(token=token.decode('utf-8'))
if source_user.affiliation is not None:
create_user_payload.update(affiliation=dict(
......@@ -1087,25 +1086,18 @@ class NomadCOEMigration:
""" Export all users as JSON. """
users = []
for source_user in self.source.query(User).all():
if source_user.user_id <= 2:
# skip first two users to keep example users
# they probably are either already the example users, or [root, Evgeny]
if source_user.user_id <= 1:
continue
user_payload = dict(
user_id=source_user.user_id,
repo_user_id=source_user.user_id,
email=source_user.email,
first_name=source_user.first_name,
last_name=source_user.last_name,
password=source_user.password,
created=source_user.created
created=source_user.created.timestamp() * 1000
)
try:
user_payload.update(token=source_user.token)
except LoginException:
pass
if source_user.affiliation is not None:
user_payload.update(
affiliation=source_user.affiliation.name,
......
......@@ -15,7 +15,7 @@ worker:
replicas: 3
routing: "worker"
dbname: fairdi_nomad_migration
dbname: fairdi_nomad_mp
postgres:
publish_enabled: false
......
......@@ -15,6 +15,7 @@ worker:
replicas: 1
routing: "queue"
processes: 10
nomadtype: "prod-worker"
dbname: fairdi_nomad_prod
......
......@@ -15,6 +15,7 @@ worker:
replicas: 1
routing: "queue"
processes: 10
nomadtype: "prod-worker"
dbname: fairdi_nomad_prod
......
......@@ -133,13 +133,13 @@ spec:
command: ["python", "-m", "gunicorn.app.wsgiapp", "--config", "gunicorn.conf", "--log-config", "gunicorn.log.conf", "-b 0.0.0.0:8000", "nomad.app:app"]
livenessProbe:
httpGet:
path: "{{ .Values.proxy.external.path }}/api/alive"
path: "{{ .Values.proxy.external.path }}/alive"
port: 8000
initialDelaySeconds: 15
periodSeconds: 15
readinessProbe:
httpGet:
path: "{{ .Values.proxy.external.path }}/api/alive"
path: "{{ .Values.proxy.external.path }}/alive"
port: 8000
initialDelaySeconds: 5
periodSeconds: 5
......
......@@ -14,7 +14,13 @@ data:
server_name www.example.com;
location {{ .Values.proxy.external.path }} {
return 301 {{ .Values.proxy.external.path }}/gui;
proxy_set_header Host $host;
proxy_pass_request_headers on;
proxy_pass http://{{ include "nomad.fullname" . }}-api:8000;
proxy_connect_timeout {{ .Values.proxy.timeout }};
proxy_send_timeout {{ .Values.proxy.timeout }};
proxy_read_timeout {{ .Values.proxy.timeout }};
send_timeout {{ .Values.proxy.timeout }};
}
location {{ .Values.proxy.external.path }}/gui {
......@@ -33,16 +39,6 @@ data:
rewrite ^{{ .Values.proxy.external.path }}/gui/service-worker.js /nomad/service-worker.js break;
}
location {{ .Values.proxy.external.path }}/api {
proxy_set_header Host $host;
proxy_pass_request_headers on;
proxy_pass http://{{ include "nomad.fullname" . }}-api:8000;
proxy_connect_timeout {{ .Values.proxy.timeout }};
proxy_send_timeout {{ .Values.proxy.timeout }};
proxy_read_timeout {{ .Values.proxy.timeout }};
send_timeout {{ .Values.proxy.timeout }};
}
location {{ .Values.proxy.external.path }}/api/uploads {
client_max_body_size 35g;
proxy_request_buffering off;
......
......@@ -22,7 +22,7 @@ data:
services:
api_host: "{{ .Values.proxy.external.host }}"
api_port: {{ .Values.proxy.external.port }}
api_base_path: "{{ .Values.proxy.external.path }}/api"
api_base_path: "{{ .Values.proxy.external.path }}"
api_secret: "{{ .Values.api.secret }}"
admin_password: "{{ .Values.api.adminPassword }}"
disable_reset: {{ .Values.api.disableReset }}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment