Skip to content

Commit

Permalink
Updated code for intermine production server setup
Browse files Browse the repository at this point in the history
  • Loading branch information
oblodgett committed Apr 19, 2022
1 parent b26d5b9 commit 065078d
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 11 deletions.
7 changes: 3 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ DOCKER_PULL_TAG := latest
DOCKER_BUILD_TAG := latest

build: pull
docker build -t agrlocal/agr_ansible_run_unlocked:${DOCKER_BUILD_TAG} --build-arg REG=${REG} --build-arg DOCKER_PULL_TAG=${DOCKER_PULL_TAG} .
docker build --no-cache -t agrlocal/agr_ansible_run_unlocked:${DOCKER_BUILD_TAG} --build-arg REG=${REG} --build-arg DOCKER_PULL_TAG=${DOCKER_PULL_TAG} .

registry-docker-login:
ifneq ($(shell echo ${REG} | egrep "ecr\..+\.amazonaws\.com"),)
Expand Down Expand Up @@ -64,12 +64,11 @@ openvpn_server:
docker run -it -e PLAYBOOK_NAME="OpenVPN Server" agrlocal/agr_ansible_run_unlocked:latest ansible-playbook -e env=build -e WEBSERVER_INSTANCE_TYPE=t3.small -e SKIP_NVME_DRIVES=true -i hosts custom_playbook_launch_instance_bare.yml --vault-password-file=.password

start_build_intermine_app_server:
docker run -it -e PLAYBOOK_NAME="Build Intermine App Server" -e SKIP_NVME_DRIVES=true -e START_GOCD_AGENT=true -e WEBSERVER_INSTANCE_TYPE=m4.xlarge agrlocal/agr_ansible_run_unlocked:latest ansible-playbook -e SKIP_NVME_DRIVES=true -e env=build -i hosts custom_playbook_launch_web_instance.yml --vault-password-file=.password
docker run -it -e PLAYBOOK_NAME="Build Intermine App Server" -e SKIP_NVME_DRIVES=true -e SETUP_NVME_DRIVE=true -e START_GOCD_AGENT=true -e WEBSERVER_INSTANCE_TYPE=i3.xlarge agrlocal/agr_ansible_run_unlocked:latest ansible-playbook -e SETUP_NVME_DRIVE=true -e SKIP_NVME_DRIVES=true -e env=build -i hosts custom_playbook_launch_intermine_instance.yml --vault-password-file=.password

start_production_intermine_app_server:
docker run -it -e PLAYBOOK_NAME="Production Intermine App Server" -e SKIP_NVME_DRIVES=true -e WEBSERVER_INSTANCE_TYPE=m4.xlarge agrlocal/agr_ansible_run_unlocked:latest ansible-playbook -e SKIP_NVME_DRIVES=true -e START_GOCD_AGENT=true -e env=production -i hosts custom_playbook_launch_web_instance.yml --vault-password-file=.password
docker run -it -e PLAYBOOK_NAME="Production Intermine App Server" -e SKIP_NVME_DRIVES=true -e SETUP_NVME_DRIVE=true -e START_GOCD_AGENT=true -e WEBSERVER_INSTANCE_TYPE=i3.xlarge agrlocal/agr_ansible_run_unlocked:latest ansible-playbook -e SETUP_NVME_DRIVE=true -e SKIP_NVME_DRIVES=true -e env=intermineproduction -i hosts custom_playbook_launch_intermine_instance.yml --vault-password-file=.password

CLUSTER_MACHINE_TYPE := i3.large

start_node%:
docker run -it -e PLAYBOOK_NAME="Build ES Cluster $*" agrlocal/agr_ansible_run_unlocked:latest ansible-playbook -e CLUSTER_NODE=NODE$* -e COMPUTE_INSTANCE_TYPE=${CLUSTER_MACHINE_TYPE} -e SKIP_NVME_DRIVES=true -e env=build -i hosts playbook_launch_cluster_node.yml --vault-password-file=.password
22 changes: 22 additions & 0 deletions custom_playbook_launch_intermine_instance.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---

- import_playbook: playbook_launch_pre_tasks.yml
- import_playbook: playbook_launch_web_instance.yml
- import_playbook: playbook_launch_post_tasks.yml
- import_playbook: playbook_launch_monitoring.yml

- name: configure servers
hosts: launched
user: core
gather_facts: false

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: Start GoCD agent
block:
- include_tasks: tasks/start_gocd_agent.yml
15 changes: 15 additions & 0 deletions environments/intermineproduction/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---

PLAYBOOK_NAME: "{{ lookup('env','PLAYBOOK_NAME') or 'No Name Specified' }}"
THREADED: "{{ lookup('env','THREADED') or 'true' }}"
NET: "intermineproduction"
DOWNLOAD_HOST: "download.alliancegenome.org"
FMS_API_URL: "https://fms.alliancegenome.org"
GENERATE_REPORTS: "true"
LOADER_TEST_SET: "false"
NGINX_TAG: "{{ DOCKER_PULL_TAG }}"
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 }}"

INTERMINE_PGUSER: "{{ INTERMINE_PROD_PGUSER }}"
INTERMINE_PGPASSWORD: "{{ INTERMINE_PROD_PGPASSWORD }}"
6 changes: 3 additions & 3 deletions roles/setup_nvme_drive/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@
mode: "711"

- name: Create Partitions
shell: echo -e "p\nn\np\n1\n\n\nw" | fdisk /dev/nvme1n1
shell: echo -e "p\nn\np\n1\n\n\nw" | fdisk /dev/nvme0n1

- name: Create File System
command: mkfs.ext4 -F /dev/nvme1n1p1
command: mkfs.ext4 -F /dev/nvme0n1p1

- name: Mount Drive AS docker FS
mount:
src: /dev/nvme1n1p1
src: /dev/nvme0n1p1
path: /var/lib/docker
state: mounted
fstype: ext4
Expand Down
8 changes: 4 additions & 4 deletions tasks/start_gocd_agent.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
docker_image:
name: "{{ GOCD_IMAGE }}"
source: pull
when: "{{ START_GOCD_AGENT }}"
when: START_GOCD_AGENT == "true"

- name: Run GoCD Agent 0
docker_container:
Expand All @@ -18,7 +18,7 @@
GO_SERVER_URL: "http://gocd.alliancegenome.org:8153/go"
network_mode: "{{ NET }}"
recreate: yes
when: "{{ START_GOCD_AGENT }}"
when: START_GOCD_AGENT == "true"

- name: Run GoCD Agent 1
docker_container:
Expand All @@ -34,7 +34,7 @@
GO_SERVER_URL: "http://gocd.alliancegenome.org:8153/go"
network_mode: "{{ NET }}"
recreate: yes
when: "{{ START_GOCD_AGENT }}"
when: START_GOCD_AGENT == "true"

- name: Run GoCD Agent 2
docker_container:
Expand All @@ -50,4 +50,4 @@
GO_SERVER_URL: "http://gocd.alliancegenome.org:8153/go"
network_mode: "{{ NET }}"
recreate: yes
when: "{{ START_GOCD_AGENT }}"
when: START_GOCD_AGENT == "true"

0 comments on commit 065078d

Please sign in to comment.