-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #90 from RNAcentral/cloud-nfs
Cloud nfs
- Loading branch information
Showing
49 changed files
with
4,732 additions
and
3,480 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
- name: Download sequence database | ||
hosts: producer | ||
become: true | ||
gather_facts: no | ||
user: centos | ||
|
||
tasks: | ||
- name: Download compressed archive from RNAcentral FTP | ||
get_url: | ||
url: ftp://ftp.ebi.ac.uk/pub/databases/RNAcentral/current_release/sequences/.internal/sequence-database.fa.tar.gz | ||
dest: /nfs/sequence-database.fa.tar.gz | ||
|
||
- name: Uncompress the archive | ||
shell: tar -xf sequence-database.fa.tar.gz | ||
args: | ||
chdir: /nfs | ||
creates: /nfs/zwd.fasta |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
--- | ||
- import_playbook: nfs-server.yml | ||
- import_playbook: nfs-client.yml | ||
- import_playbook: download-sequences.yml | ||
- import_playbook: postgres.yml | ||
- import_playbook: producer.yml | ||
|
||
|
||
- hosts: producer | ||
gather_facts: Yes | ||
remote_user: centos | ||
become: true | ||
become_method: sudo | ||
vars: | ||
ansible_ssh_private_key_file: "../terraform/sequence_search_rsa" | ||
tasks: | ||
- name: Drop the database and re-create it | ||
shell: | ||
chdir: /srv | ||
cmd: ENVIRONMENT=PRODUCTION python3 -m sequence_search.db | ||
|
||
|
||
- import_playbook: consumers.yml | ||
- import_playbook: monitor.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
- hosts: monitor | ||
remote_user: centos | ||
become: true | ||
become_method: sudo | ||
vars: | ||
ansible_ssh_private_key_file: "../terraform/sequence_search_rsa" | ||
floating_ip: "{{ lookup('pipe', 'cd ../terraform && terraform output floating_ip') }}" | ||
roles: | ||
- monitor | ||
- ssh | ||
- iptables |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
- name: NFS client installation and nfs server mount | ||
vars: | ||
ansible_ssh_private_key_file: "../terraform/sequence_search_rsa" | ||
nfs_server_ip: 192.168.0.7 | ||
nfs_mount_path: "/nfs" | ||
hosts: producer:consumers | ||
become: true | ||
gather_facts: no | ||
user: centos | ||
|
||
tasks: | ||
- name: Upgrade all packages | ||
yum: name=* state=latest | ||
|
||
- name: Install yum dependencies | ||
yum: | ||
name: | ||
- nfs-utils | ||
|
||
- name: Create an nfs directory where to mount nfs server dir | ||
file: | ||
path: "{{ nfs_mount_path }}" | ||
state: directory | ||
mode: "u=r,g=r,o=rwx" # might need to change these privileges | ||
recurse: yes | ||
|
||
- name: Mount nfs server directory on clients | ||
mount: | ||
path: "{{ nfs_mount_path }}" | ||
src: "{{ nfs_server_ip }}:/" | ||
fstype: nfs | ||
state: mounted |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
- name: NFS server installation and setup | ||
hosts: nfs_server | ||
vars: | ||
ansible_python_interpreter: "/usr/bin/python3" # set ansible interpreter to python3 | ||
ansible_ssh_private_key_file: "../terraform/sequence_search_rsa" | ||
network_ip: 192.168.0.0/24 | ||
become: true | ||
gather_facts: no | ||
user: ubuntu | ||
|
||
tasks: | ||
- name: Update and upgrade apt packages | ||
apt: | ||
upgrade: yes | ||
update_cache: yes | ||
cache_valid_time: 86400 | ||
|
||
- name: Update apt | ||
apt: | ||
update_cache: yes | ||
state: present | ||
|
||
- name: Install nfs on the compute instance | ||
apt: | ||
name: "{{ packages }}" | ||
state: present | ||
vars: | ||
packages: | ||
- python3-pip | ||
- nfs-kernel-server | ||
|
||
- name: Create the export nfs directory | ||
file: | ||
path: /nfs | ||
state: directory | ||
mode: "u=r,g=r,o=rwx" | ||
recurse: yes | ||
|
||
- name: Format the volume | ||
filesystem: | ||
fstype: xfs | ||
dev: /dev/vdb | ||
|
||
- name: Mount volume to nfs directory | ||
mount: | ||
path: /nfs | ||
src: /dev/vdb | ||
fstype: xfs | ||
state: mounted | ||
|
||
- name: Make nfs directory accessible to all | ||
file: | ||
path: /nfs | ||
owner: nobody | ||
group: nogroup | ||
|
||
- name: chmod 777 equivalent | ||
file: | ||
path: /nfs | ||
mode: u=rwX,g=rwX,o=rwX | ||
recurse: yes | ||
|
||
- name: Create exports file | ||
lineinfile: | ||
dest: /etc/exports | ||
regexp: '^#*' | ||
insertafter: '^#*' | ||
line: "/nfs {{ network_ip }}(rw,sync,fsid=0,crossmnt,no_subtree_check,no_root_squash)" | ||
owner: root | ||
group: root | ||
mode: 0644 | ||
state: present | ||
|
||
- name: restart nfs server | ||
service: | ||
name: nfs-kernel-server | ||
state: restarted | ||
|
||
- name: Import ssh role | ||
import_role: | ||
name: ssh | ||
|
||
- name: Import iptables role | ||
import_role: | ||
name: iptables |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -68,4 +68,6 @@ | |
- '*' | ||
|
||
roles: | ||
- postgresql | ||
- postgresql | ||
- ssh | ||
- iptables |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
# Playbook to restore a PostgreSQL database from an archive file created by pg_dump | ||
- hosts: postgres | ||
remote_user: centos | ||
become: true | ||
become_method: sudo | ||
vars: | ||
ansible_ssh_private_key_file: "../terraform/sequence_search_rsa" | ||
tasks: | ||
- copy: src=producer_latest.dump dest=/tmp/producer_latest.dump mode=0777 | ||
- shell: pg_restore -U docker -c -n public -n pg_catalog -d producer /tmp/producer_latest.dump | ||
|
||
- import_playbook: consumers.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.