From a916322c3013d7db2fa0693d9e09a27e24a86296 Mon Sep 17 00:00:00 2001 From: Ilya Kreymer Date: Thu, 12 Jan 2023 23:11:20 -0800 Subject: [PATCH] ansible: digitalocean tweaks: (#469) * ansible: digitalocean tweaks: - add org_name to template - better check for db existence - simplify domain, fix default_org chart: - make job images pull IfNotPresent --- ansible/group_vars/do/do-values.template.yaml | 4 ++++ ansible/group_vars/do/main.yml | 6 ++++-- ansible/playbooks/do_setup.yml | 4 +++- backend/btrixcloud/k8s/templates/crawl_job.yaml | 2 +- backend/btrixcloud/k8s/templates/profile_job.yaml | 2 +- 5 files changed, 13 insertions(+), 5 deletions(-) diff --git a/ansible/group_vars/do/do-values.template.yaml b/ansible/group_vars/do/do-values.template.yaml index 7441fd5e..7f477b60 100644 --- a/ansible/group_vars/do/do-values.template.yaml +++ b/ansible/group_vars/do/do-values.template.yaml @@ -9,6 +9,8 @@ crawler_limits_cpu: "2200m" crawler_requests_memory: "1200Mi" crawler_limits_memory: "3200Mi" +crawler_pull_policy: "Always" + # Registry {% if use_do_registry %} api_image: "{{ registry_endpoint }}/webrecorder/browsertrix-backend:{{ image_tag }}" @@ -59,6 +61,8 @@ superuser: registration_enabled: "{{ '1' if registration_enabled else '0' }}" +default_org: "{{ org_name }}" + # Admin Send Email Options email: diff --git a/ansible/group_vars/do/main.yml b/ansible/group_vars/do/main.yml index f967829d..0e6d3e24 100644 --- a/ansible/group_vars/do/main.yml +++ b/ansible/group_vars/do/main.yml @@ -15,7 +15,7 @@ k8s_name: "{{ project_name }}" bucket_name: "{{ project_name }}" bucket_path: "crawls" -domain: "{{ domain_name | default('browsertrix.cloud') }}" +domain: "browsertrix.cloud" subdomain: "{{ project_name }}" use_do_registry: true @@ -27,7 +27,9 @@ signing_host: "signing" superuser_email: "dev@webrecorder.net" superuser_password: "PassW0rd!" -registration_enabled: true +org_name: "{{ project_name }}" + +registration_enabled: false cert_email: "{{ superuser_email }}" diff --git a/ansible/playbooks/do_setup.yml b/ansible/playbooks/do_setup.yml index 14044d65..cbbb34a9 100644 --- a/ansible/playbooks/do_setup.yml +++ b/ansible/playbooks/do_setup.yml @@ -35,15 +35,17 @@ async: 1800 poll: 60 register: db_create_result - when: db_check.stdout.find(db_name) == -1 + when: "db_check.stdout.find(' ' + db_name + ' ') == -1" - name: d_ocean | db | set db url ansible.builtin.set_fact: db_url: "{{ db_create_result.stdout | from_json | json_query('[0].private_connection.uri') }}" + when: "db_check.stdout.find(' ' + db_name + ' ') == -1" - name: d_ocean | db | set db id ansible.builtin.set_fact: db_uuid: db_create_result.stdout | from_json | json_query('[0].id') + when: "db_check.stdout.find(' ' + db_name + ' ') == -1" # Storage (Space) # =========================================== diff --git a/backend/btrixcloud/k8s/templates/crawl_job.yaml b/backend/btrixcloud/k8s/templates/crawl_job.yaml index f7aa8a12..ccfd5f36 100644 --- a/backend/btrixcloud/k8s/templates/crawl_job.yaml +++ b/backend/btrixcloud/k8s/templates/crawl_job.yaml @@ -41,7 +41,7 @@ spec: containers: - name: crawl-job image: {{ job_image }} - imagePullPolicy: Never + imagePullPolicy: IfNotPresent command: ["uvicorn", "btrixcloud.k8s.crawl_job:app", "--host", "0.0.0.0", "--access-log", "--log-level", "info"] volumeMounts: diff --git a/backend/btrixcloud/k8s/templates/profile_job.yaml b/backend/btrixcloud/k8s/templates/profile_job.yaml index 4c560cd1..3f3f98e6 100644 --- a/backend/btrixcloud/k8s/templates/profile_job.yaml +++ b/backend/btrixcloud/k8s/templates/profile_job.yaml @@ -45,7 +45,7 @@ spec: containers: - name: crawl-job image: {{ job_image }} - imagePullPolicy: Never + imagePullPolicy: IfNotPresent command: ["python", "-m", "btrixcloud.k8s.profile_job"] volumeMounts: