Skip to content

Commit c7a5908

Browse files
committed
run.sh
1 parent c4a1a9c commit c7a5908

File tree

2 files changed

+55
-9
lines changed

2 files changed

+55
-9
lines changed

registry/coder/modules/nextflow/main.tf

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,6 @@ variable "http_server_reports_dir" {
3838
default = "reports"
3939
}
4040

41-
variable "checkout_demos" {
42-
type = bool
43-
description = "Checkout demos?"
44-
default = false
45-
}
46-
4741
variable "stub_run" {
4842
type = bool
4943
description = "Execute a stub run?"
@@ -52,8 +46,8 @@ variable "stub_run" {
5246

5347
variable "stub_run_command" {
5448
type = string
55-
description = "Shell command to be executed during the stub run."
56-
default = "nextflow run . -stub-run"
49+
description = "Nextflow command to be executed in the stub run."
50+
default = "run rnaseq-nf -with-report reports/report.html -with-trace reports/trace.txt -with-timeline reports/timeline.html -with-dag reports/flowchart.png"
5751
}
5852

5953
variable "order" {
@@ -86,7 +80,6 @@ resource "coder_script" "nextflow" {
8680
PROJECT_PATH : var.project_path,
8781
HTTP_SERVER_PORT : var.http_server_port,
8882
HTTP_SERVER_REPORTS_DIR : var.http_server_reports_dir,
89-
CHECKOUT_DEMOS : var.checkout_demos,
9083
STUB_RUN : var.stub_run,
9184
STUB_RUN_COMMAND : var.stub_run_command,
9285
})
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#!/usr/bin/env sh
2+
3+
set -eu
4+
5+
BOLD='\033[0;1m'
6+
RESET='\033[0m'
7+
8+
printf "$${BOLD}Starting Nextflow...$${RESET}\n"
9+
10+
if ! command -v nextflow > /dev/null 2>&1; then
11+
# Update system dependencies
12+
sudo apt update
13+
sudo apt install openjdk-18-jdk -y
14+
sudo apt install salmon fastqc multiqc -y
15+
16+
# Install nextflow
17+
export NXF_VER=${NEXTFLOW_VERSION}
18+
curl -s https://get.nextflow.io | bash
19+
sudo mv nextflow /usr/local/bin/
20+
sudo chmod +x /usr/local/bin/nextflow
21+
22+
# Verify installation
23+
tmp_verify=$$(mktemp -d coder-nextflow-XXXXXX)
24+
nextflow run hello \
25+
-with-report "$$tmp_verify/report.html" \
26+
-with-trace "$$tmp_verify/trace.txt" \
27+
-with-timeline "$$tmp_verify/timeline.html" \
28+
-with-dag "$$tmp_verify/flowchart.png"
29+
rm -f "$$tmp_verify"
30+
else
31+
echo "Nextflow is already installed\n\n"
32+
fi
33+
34+
if [ ! -z ${PROJECT_PATH} ]
35+
then
36+
# Project is located at PROJECT_PATH
37+
echo "Change directory: ${PROJECT_PATH}"
38+
cd ${PROJECT_PATH}
39+
fi
40+
41+
# Start a web server to preview reports
42+
mkdir -p ${HTTP_SERVER_REPORTS_DIR}
43+
python3 -m http.server --directory ${HTTP_SERVER_REPORTS_DIR} ${HTTP_SERVER_PORT}
44+
45+
# Stub run?
46+
if [ "${STUB_RUN}" = "true" ]
47+
then
48+
nextflow ${STUB_RUN_COMMAND} -stub-run
49+
fi
50+
51+
printf "\n$${BOLD}Nextflow ${NEXTFLOW_VERSION} is ready. HTTP server is listening on port ${HTTP_SERVER_PORT}$${RESET}\n"
52+
53+

0 commit comments

Comments
 (0)