diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..cfae816 --- /dev/null +++ b/.env.example @@ -0,0 +1,28 @@ +# Copy this file to `template/.env` and adjust values for your site. +# Runtime settings +OOD_RESULTS_URL_BASE=/pun/sys/dashboard/files/fs +PFOLD_SCRIPT_FILE=/path/to/proteinfold/bin/start-alphafold2.sh +PFOLD_NATIVE_DEFAULT="-A your_project;-l select=1:ncpus=2:mem=4gb;-l walltime=48:00:00" +PFOLD_NATIVE_GPU="-l select=1:ncpus=8:ngpus=1:mem=124gb;-l walltime=12:00:00" + +# Pipeline locations +PFOLD_RUN_ENVIRONMENT=prod +PFOLD_PROJECT_ROOT=/path/to/proteinfold +PFOLD_DB_PATH=/path/to/proteinfold/dbs +PFOLD_BRANCH=2.0.0 +PFOLD_REPOSITORY=nf-core/proteinfold +PFOLD_NEXTFLOW_CONFIG=/path/to/proteinfold/nextflow.config + +# Runtime directories +PFOLD_BASE_OUT_DIR=/path/to/output/proteinfold_output +PFOLD_BASE_DEBUGDIR=/path/to/debug +PFOLD_BASE_NXF_WORK=/path/to/work/proteinfold +PFOLD_DEBUGGROUP=your_group + +# Container caches +APPTAINER_CACHEDIR=/path/to/cache/apptainer +SINGULARITY_CACHEDIR=/path/to/cache/singularity +NXF_APPTAINER_CACHEDIR=/path/to/cache/apptainer +NXF_SINGULARITY_CACHEDIR=/path/to/cache/singularity +NXF_APPTAINER_LIBRARYDIR=/path/to/library/apptainer +NXF_SINGULARITY_LIBRARYDIR=/path/to/library/singularity diff --git a/.gitignore b/.gitignore index 4c49bd7..ad2fcc1 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ .env +template/.env diff --git a/README.md b/README.md index 017eb02..ae438bf 100644 --- a/README.md +++ b/README.md @@ -33,51 +33,27 @@ To deploy ProteinFold on your own Open OnDemand instance: git clone https://github.com/Australian-Structural-Biology-Computing/ood-proteinfold.git /var/www/ood/apps/sys/kod-proteinfold ``` -2. **Edit files to match institutional settings**: - - Update `submit.yml.erb` with your facility-specific settings. - - Change the cluster in `form.yml.erb` to match your HPC. - - Create `kod_proteinfold-${RUN_ENVIRONMENT}.config` files for proteinfold-specific nextflow configurations. Or remove this line from `script.sh.erb` if not needed. - - Create a `template/.env` file to change any of these default parameters: +2. **Configure for your site**: + - Copy `.env.example` to `template/.env`. + - Adjust the runtime environment variables in `template/.env` for paths, caches, output locations, and other job-time settings. + - Adjust the portal-side defaults at the top of the ERB files for cluster, queue, and other pre-submit settings. + - If needed, set `PFOLD_NEXTFLOW_CONFIG` to your institutional Nextflow config file instead of editing `script.sh.erb`. ``` -# Example .env for ood-proteinfold - -# Base output directory for all runs (job-specific OUT_DIR set at runtime) -BASE_OUT_DIR=/srv/scratch/${USER}/proteinfold_output - -# Environment name (e.g., prod, dev) -RUN_ENVIRONMENT=prod - -# Project root: location of Nextflow configs and samplesheet-utils environment -PROJECT_ROOT=/srv/scratch/sbf-pipelines/proteinfold - -# Database path for structure prediction modules -DB_PATH=/srv/scratch/sbf-pipelines/proteinfold/dbs - -# Git branch to use for proteinfold -BRANCH=master - -# Repository path for using alternative versions of proteinfold -REPOSITORY=Australian-Structural-Biology-Computing/proteinfold - -# Debug group for permissions on debug files -DEBUGGROUP=sbf-pipelines - -# Base debug directory (job-specific DEBUGDIR set at runtime) -BASE_DEBUGDIR=/srv/scratch/sbf/debug - -# Nextflow work directory base (job-specific NXF_WORK set at runtime) -BASE_NXF_WORK=/srv/scratch/${USER}/.proteinfold/work - -# Apptainer/Singularity blob cache directories (set here or via your institutional Nextflow config, e.g. https://github.com/Australian-Structural-Biology-Computing/unsw_katana) -# APPTAINER_CACHEDIR=/srv/scratch/${USER}/.images -# SINGULARITY_CACHEDIR=/srv/scratch/${USER}/.images - -# Nextflow Apptainer/Singularity image cache/library directories (set here or via institutional Nextflow config, e.g. https://github.com/nf-core/configs/blob/master/conf/pipeline/proteinfold/unsw_katana.config) -# NXF_APPTAINER_CACHEDIR=/srv/scratch/${USER}/.images -# NXF_SINGULARITY_CACHEDIR=/srv/scratch/${USER}/.images -# NXF_APPTAINER_LIBRARYDIR=/srv/scratch/sbf-pipelines/proteinfold/singularity -# NXF_SINGULARITY_LIBRARYDIR=/srv/scratch/sbf-pipelines/proteinfold/singularity +# Example template/.env for ood-proteinfold + +PFOLD_SCRIPT_FILE=/path/to/proteinfold/bin/start-alphafold2.sh +PFOLD_NATIVE_DEFAULT=-A my_project;-l select=1:ncpus=2:mem=4gb;-l walltime=48:00:00 +PFOLD_NATIVE_GPU=-l select=1:ncpus=8:ngpus=1:mem=124gb;-l walltime=12:00:00 +PFOLD_RUN_ENVIRONMENT=prod +PFOLD_PROJECT_ROOT=/apps/proteinfold +PFOLD_DB_PATH=/data/proteinfold/dbs +PFOLD_BRANCH=master +PFOLD_REPOSITORY=Australian-Structural-Biology-Computing/proteinfold +PFOLD_NEXTFLOW_CONFIG=/apps/proteinfold/site.config +PFOLD_BASE_OUT_DIR=/scratch/${USER}/proteinfold_output +PFOLD_BASE_NXF_WORK=/scratch/${USER}/.proteinfold/work +OOD_RESULTS_URL_BASE=/pun/sys/dashboard/files/fs ``` ### Python Environment for samplesheet-utils @@ -91,7 +67,13 @@ source ${PROJECT_ROOT}/${RUN_ENVIRONMENT}/venv/bin/activate pip install samplesheet-utils==1.1.2 ``` -Update the paths in `.env` if your environment is elsewhere. +Prefer changing `template/.env` over editing the app templates directly so upgrades stay easy to rebase across institutions. + +Portal rendering and job runtime are configured differently: +- portal-side defaults live at the top of `form.yml.erb`, `submit.yml.erb`, `info.html.erb`, `completed.html.erb`, and `view.html.erb` +- runtime config lives in `template/.env`, which is intentionally gitignored + +For CI/CD, prefer generating `template/.env` during deployment from site-managed config or secrets rather than committing a real site config file to the repository. ## Citation diff --git a/completed.html.erb b/completed.html.erb index 130adc1..a962927 100644 --- a/completed.html.erb +++ b/completed.html.erb @@ -1,5 +1,8 @@ <% if !connect.user.blank? %> <% +portal_default_base_out_dir = "/srv/scratch/#{connect.user}/proteinfold_output" +portal_default_results_url_base = "/pun/sys/dashboard/files/fs" + def file_url(base, path) encoded_path = path.to_s.split("/").reject(&:empty?).map { |segment| ERB::Util.url_encode(segment) }.join("/") "#{base}/#{encoded_path}" @@ -69,8 +72,8 @@ def sanitize_live_log(text) compact.join("\n").strip end -base_out_dir = (connect.respond_to?(:base_out_dir) && !connect.base_out_dir.blank?) ? connect.base_out_dir : "/srv/scratch/#{connect.user}/proteinfold_output" -results_url_base = (connect.respond_to?(:results_url_base) && !connect.results_url_base.blank?) ? connect.results_url_base : "/pun/sys/dashboard/files/fs" +base_out_dir = (connect.respond_to?(:base_out_dir) && !connect.base_out_dir.blank?) ? connect.base_out_dir : portal_default_base_out_dir +results_url_base = (connect.respond_to?(:results_url_base) && !connect.results_url_base.blank?) ? connect.results_url_base : portal_default_results_url_base session_output_dir = (connect.respond_to?(:session_output_dir) && !connect.session_output_dir.blank?) ? connect.session_output_dir : nil log_dir = session_output_dir || File.join(base_out_dir, connect.run_dir) live_log_path = File.join(log_dir, "live_log.log") @@ -82,7 +85,7 @@ summary_log_label = File.file?(output_log_path) ? "output.log" : "live_log.log" log_text = sanitize_live_log(tail_text(live_log_path)) %>
-
Log: <%= summary_log_label %>
+
Log: <%= summary_log_label %>
<% if log_text && !log_text.empty? %>
<%= ERB::Util.html_escape(log_text) %>