From b518c7f54429765f43e24414b571227b9cf39414 Mon Sep 17 00:00:00 2001 From: Production User Date: Wed, 26 Apr 2023 01:28:30 +0000 Subject: [PATCH] initial commit of basesite. --- LICENSE | 21 ++++++++ README.md | 2 + breedbase_nginx.conf | 47 +++++++++++++++++ crontab | 21 ++++++++ docker-compose.yml | 41 +++++++++++++++ dump | 16 ++++++ firewall | 8 +++ sgn_local.conf | 120 +++++++++++++++++++++++++++++++++++++++++++ 8 files changed, 276 insertions(+) create mode 100644 LICENSE create mode 100644 README.md create mode 100644 breedbase_nginx.conf create mode 100644 crontab create mode 100644 docker-compose.yml create mode 100755 dump create mode 100644 firewall create mode 100644 sgn_local.conf diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..4d42749 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 codingstrand + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..b090d99 --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ + +Use this repo to create repos for other sites. diff --git a/breedbase_nginx.conf b/breedbase_nginx.conf new file mode 100644 index 0000000..7590485 --- /dev/null +++ b/breedbase_nginx.conf @@ -0,0 +1,47 @@ +# +server { + + listen 80; + + root /var/www/html; + + server_name sample.breedbase.org; + + client_max_body_size 1G; + + location ~/brapi/ { + auth_basic "off"; + proxy_read_timeout 100m; + proxy_pass http://127.0.0.1:8080; + } + + location ~/user/login { + auth_basic "off"; + proxy_pass http://127.0.0.1:8080; + } + + location ~/.well-known/openid-configuration { + auth_basic "off"; + proxy_pass http://127.0.0.1:8080; + } + + location ~/brapi/authorize { + auth_basic "off"; + proxy_pass http://127.0.0.1:8080; + } + + + + location / { + proxy_pass http://127.0.0.1:8080; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header Host $host; + proxy_read_timeout 100m; + auth_basic "Restricted - Authorized Users Only"; + auth_basic_user_file /etc/nginx/.htpasswd; + } + + +} + diff --git a/crontab b/crontab new file mode 100644 index 0000000..4056fcd --- /dev/null +++ b/crontab @@ -0,0 +1,21 @@ +# /etc/crontab: system-wide crontab +# Unlike any other crontab you don't have to run the `crontab' +# command to install the new version when you edit this file +# and files in /etc/cron.d. These files also have username fields, +# that none of the other crontabs do. + +SHELL=/bin/sh +PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin + +# m h dom mon dow user command +17 * * * * root cd / && run-parts --report /etc/cron.hourly +25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily ) +47 6 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly ) +52 6 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly ) +# + +### BREEDBASE SPECIFIC CRONTAB ENTRIES: +# +30 00 * * * root /db_dumps/dump + +###* * * * * root date diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..0645982 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,41 @@ +version: "3.7" + +services: + breedbase: + image: breedbase/breedbase:v0.70 + depends_on: + - breedbase_db + container_name: breedbase_web + ports: + - 8080:8080 + - 25:25 + volumes: + - webdata:/home/production/volume + - type: bind + source: /home/production/basesite/empty_db_without.test_users.sql + target: /home/production/empty_dump.sql +# - type: bind +# source: /home/production/sgn +# target: /home/production/cxgn/sgn + - type: bind + source: /home/production/basesite.breedbase.org/sgn_local.conf + target: /home/production/cxgn/sgn/sgn_local.conf + - type: bind + source: /home/production/db_dumps + target: /db_dumps + - type: bind + source: /home/production/basesite/crontab + target: /etc/crontab + + breedbase_db: + image: breedbase/pg:latest + container_name: breedbase_db + volumes: + - dbdata:/var/lib/postgresql/data + +volumes: + webdata: + dbdata: + + + diff --git a/dump b/dump new file mode 100755 index 0000000..e7ec2b8 --- /dev/null +++ b/dump @@ -0,0 +1,16 @@ +#!/bin/bash + +export DATE=`date --iso-8601`; + +echo "Dumping breedbase db, $DATE"; + +rm $HOME/.pgpass + +echo "breedbase_db:5432:breedbase:postgres:postgres"> $HOME/.pgpass + +chmod 0600 $HOME/.pgpass + +ls -al $HOME/.pgpass + +pg_dump -h breedbase_db -U postgres -w -d breedbase > /db_dumps/breedbase_$DATE.sql + diff --git a/firewall b/firewall new file mode 100644 index 0000000..366609c --- /dev/null +++ b/firewall @@ -0,0 +1,8 @@ +#!/bin/bash + +# Firewall that will prevent port 8080 and 5432 to be accessible from the outside world + +echo "1" > /proc/sys/net/ipv4/ip_forward + +iptables -I FORWARD -p tcp ! -i 0.0.0.0 --dport 8080 -j DROP # 8080 only accessible through localhost +iptables -I FORWARD -p tcp ! -i 0.0.0.0 --dport 5432 -j DROP # postgres only accessible through localhost diff --git a/sgn_local.conf b/sgn_local.conf new file mode 100644 index 0000000..708d673 --- /dev/null +++ b/sgn_local.conf @@ -0,0 +1,120 @@ +dbhost breedbase_db +dbname breedbase +dbuser postgres +dbpass postgres + +rootpath /home/production/cxgn +basepath /home/production/cxgn/sgn + +#composable_cvs trait,toy # see below +#composable_cvs_allowed_combinations Time Series|trait+toy + +homepage_files_dir /home/production/volume/public/static_content + +trial_download_logfile /home/production/volume/logs/cassava_trial_download_log +static_datasets_url /data +disable_login 0 +brapi_require_login 0 +require_login 1 + +www_user www-data +www_group www-data + +contact_form_email info@codingstrand.com + +error_log /var/log/sgn/error.log +access_log /var/log/sgn/access.log + +python_executable python3 + +preferred_species Manihot esculenta + +production_server 1 +image_dir /images/ +image_path /home/production/volume/public/images/ +cluster_shared_tempdir /home/production/volume/tmp +tempfiles_base /home/production/volume/tmp/breedbase-site +static_datasets_path /home/production/volume/public +static_content_url /static_content +static_content_path /home/production/volume/public/static_content + +main_production_site_url https://sample.breedbase.org + +# github token for contact form +github_access_token 96d462a40bc3504f4768559e752f7eec16ff2bc1 + +#Homepage controller customization +homepage_display_phenotype_uploads 0 + +# jbrowse path +jbrowse_path /jbrowse_cassavabase/?data=data/json + +#path for archving uploaded files +archive_path /home/production/volume/archive/breedbase/ + +default_genotyping_protocol "GBS ApeKI Cassava genome v6_Oct2015" +#default_genotyping_protocol "GBS ApeKI Cassava genome v5" + +identifier_prefix BB +project_name Sample +cview_db_backend Cassava + +# slurm config +backend Slurm +cluster_host "" +cache_file_path /home/production/volume/cache +solgs_dir /home/production/tmp/solgs/__USERNAME__ + +trait_ontology_db_name CO_322 + +trait_cv_name maize_trait + +#For display on onto tree +#onto_root_namespaces NO (NCSU_ontology), GO (Gene Ontology), PO (Plant Ontology), SO (Sequence Ontology), PATO (Phenotype and Trait Ontology) +#onto_root_namespaces CO_334 (Cassava Trait Ontology), GO (Gene Ontology), PO (Plant Ontology), SO (Sequence Ontology), PATO (Phenotype and Trait Ontology), DL_001 (Dawson Lab Ontology), TO (Time Ontology) +onto_root_namespaces CO_322 (Maize Trait) + +#For display on trait search +trait_variable_onto_root_namespaces CO_322 (Maize Trait), COMP (Composed Variables) + +composable_cvs trait,attribute +composable_cvs_allowed_combinations trait+attribute+toy + + + cview_default_map_id 1 + + +r_qtl_temp_path /export/prod/tmp/solqtl___USERNAME__ + +submit_dir /home/production/public/submit-uploads + +blast_path "" +blast_db_path /home/production/volume/blast/databases/current + +# path to our production_ftp site +# +ftpsite_root /home/production/volume/public + + + add_comp_root /home/production/cxgn/auburn/mason + + + + dsn dbi:Pg:host=localhost;dbname=cxgn + user postgres + password + + search_path public + search_path sgn + search_path annotation + search_path genomic + search_path insitu + search_path metadata + search_path pheno_population + search_path phenome + search_path physical + search_path tomato_gff + search_path biosource + search_path gem + +