From bf048f272193f7a659c5b1925b2ec89b9df37668 Mon Sep 17 00:00:00 2001 From: Christopher Tabone Date: Mon, 12 Aug 2024 15:59:38 -0300 Subject: [PATCH] Changes to fix nginx. --- .dockerignore | 1 - environments/production/main.yml | 2 +- launch_7.3.0.yml | 127 +++++++++++++++++++++++++++++++ 3 files changed, 128 insertions(+), 2 deletions(-) delete mode 100644 .dockerignore create mode 100644 launch_7.3.0.yml diff --git a/.dockerignore b/.dockerignore deleted file mode 100644 index 7c2581a..0000000 --- a/.dockerignore +++ /dev/null @@ -1 +0,0 @@ -.password \ No newline at end of file diff --git a/environments/production/main.yml b/environments/production/main.yml index db21298..7fdef26 100644 --- a/environments/production/main.yml +++ b/environments/production/main.yml @@ -7,7 +7,7 @@ DOWNLOAD_HOST: "download.alliancegenome.org" FMS_API_URL: "https://fms.alliancegenome.org" GENERATE_REPORTS: "true" LOADER_TEST_SET: "false" -NGINX_TAG: "{{ DOCKER_PULL_TAG }}" +NGINX_TAG: "{{ NET }}" LOG_SERVER_HOST: "{{ lookup('env','LOG_SERVER_HOST') or 'logs.alliancegenome.org' }}" # Logging runs outside the docker network START_GOCD_AGENT: "{{ lookup('env','START_GOCD_AGENT') or false }}" diff --git a/launch_7.3.0.yml b/launch_7.3.0.yml new file mode 100644 index 0000000..c996cea --- /dev/null +++ b/launch_7.3.0.yml @@ -0,0 +1,127 @@ +--- + +- name: Setup SSH Keys + hosts: local + connection: local + gather_facts: False + + pre_tasks: + - name: Import Secret Variable file + include_vars: "environments/shared_secrets.yml" + + - name: Copy SSH private key file + copy: + content: "{{ AGRSSL2_content }}" + dest: "/root/.ssh/id_rsa" + mode: 0600 + +- name: Setup Docker Server + hosts: local + connection: local + gather_facts: False + + vars_files: + - "environments/{{ env }}/main.yml" # ENV must always be loaded first + - "environments/shared_secrets.yml" + - "environments/shared_aws_instance_variables.yml" + + tasks: + - name: Launch instances + ec2_instance: + key_name: AGR-ssl2 + security_groups: ["default"] + instance_type: "{{ WEBSERVER_INSTANCE_TYPE }}" + image_id: ami-05668c1bb69ebd078 + region: us-east-1 + availability_zone: us-east-1a + iam_instance_profile: S3DataAccess + aws_access_key: "{{ AWS_ACCESS_KEY }}" + aws_secret_key: "{{ AWS_SECRET_KEY }}" + volumes: + - device_name: /dev/xvda + ebs: + volume_type: gp3 + volume_size: 1700 + delete_on_termination: yes + wait: yes + wait_timeout: 600 + user_data: "" # Otherwise get weird error on start up + tags: + Name: "AGR Release 7.3.0" + register: ec2 + + - name: Add all instance public IPs to host group + add_host: + hostname: '{{ item.private_ip_address }}' + groupname: launched + with_items: "{{ ec2.instances }}" + register: launched + + - name: Retrieve all volumes for a queried instance + ec2_vol_info: + region: us-east-1 + aws_access_key: "{{ AWS_ACCESS_KEY }}" + aws_secret_key: "{{ AWS_SECRET_KEY }}" + filters: + attachment.instance-id: '{{ item.instance_id }}' + with_items: "{{ ec2.instances }}" + register: ec2_volumes + + - name: Ensure all volumes are tagged + ec2_tag: + region: us-east-1 + resource: '{{ item.1.id }}' + aws_access_key: "{{ AWS_ACCESS_KEY }}" + aws_secret_key: "{{ AWS_SECRET_KEY }}" + tags: + Name: "Ansible Generated Volume - AGR Release 7.3.0" + with_subelements: + - "{{ ec2_volumes.results }}" + - volumes + + - name: Waiting for SSH to be up + wait_for: + host: "{{ item.private_ip_address }}" + port: 22 + delay: 5 + timeout: 300 + state: started + with_items: "{{ ec2.instances }}" + +- name: Configure Servers + hosts: launched + user: core + gather_facts: False + + roles: + - install_python + - setup_docker + - setup_swap + + vars: + NEO_PAGE_CACHE: "8g" + NEO_MAX_HEAP: "6g" + REPO: "stage" + + vars_files: + - "environments/{{ env }}/main.yml" # ENV must always be loaded first + - "environments/shared_secrets.yml" + - "environments/shared_variables.yml" + - "environments/shared_aws_instance_variables.yml" + + tasks: + - name: Setup Neo, Run Loader, Run Loader Tests + block: + - include_tasks: tasks/start_monitoring.yml + - include_tasks: tasks/start_es_env.yml + - include_tasks: tasks/start_neo_data.yml + - include_tasks: tasks/start_infinispan_data.yml + - include_tasks: tasks/start_api_quarkus.yml + - include_tasks: tasks/start_jbrowse.yml + - include_tasks: tasks/start_apollo.yml + - include_tasks: tasks/run_restore_index.yml + - include_tasks: tasks/start_nginx.yml + + rescue: + - fail: + msg: 'Tasked Failed Terminating instances'