diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 4ffd47a..83df8a5 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -71,7 +71,6 @@ jobs: password: ${{ secrets.PYPI_API_TOKEN }} publish-docker: - needs: publish-pypi if: startsWith(github.ref, 'refs/tags') name: Publish script-runner to dockerhub runs-on: ubuntu-latest @@ -119,7 +118,7 @@ jobs: - name: Push to Docker Hub uses: docker/build-push-action@v2 with: - context: ./docker + context: ./ file: ./docker/Dockerfile builder: ${{ steps.buildx.outputs.name }} push: ${{ github.event_name != 'pull_request' }} @@ -135,7 +134,6 @@ jobs: PYTHON_IMAGE_TAG=${{ steps.prep.outputs.pyversion }} publish-docker-example: - needs: publish-pypi if: startsWith(github.ref, 'refs/tags') name: Publish script-runner-example to dockerhub runs-on: ubuntu-latest @@ -181,7 +179,7 @@ jobs: - name: Push to Docker Hub uses: docker/build-push-action@v2 with: - context: ./docker + context: ./ file: ./docker/Dockerfile.example builder: ${{ steps.buildx.outputs.name }} push: ${{ github.event_name != 'pull_request' }} diff --git a/example-config.json b/config.json similarity index 100% rename from example-config.json rename to config.json diff --git a/docker-compose.yaml b/docker-compose.yaml index 9d3bb95..8581726 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -3,8 +3,8 @@ services: server: image: labflow/script-runner-example:latest build: - dockerfile: ./Dockerfile.example - context: ./docker + dockerfile: ./docker/Dockerfile.example + context: ./ args: SERVER_VERSION: local+devcontainer command: "python3 -m flask run --host=0.0.0.0 --port=5000" @@ -23,8 +23,8 @@ services: worker: image: labflow/script-runner-example:latest build: - dockerfile: ./Dockerfile.example - context: ./docker + dockerfile: ./docker/Dockerfile.example + context: ./ args: SERVER_VERSION: local+devcontainer command: "python3 -m celery -A script_runner.analysis worker" diff --git a/docker/Dockerfile b/docker/Dockerfile index b7e521c..e1b78a3 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -2,18 +2,12 @@ ARG PYTHON_IMAGE_TAG=alpine FROM python:${PYTHON_IMAGE_TAG} -ARG SCRIPT_RUNNER_VERSION=local+container - WORKDIR /app -RUN pip install \ - script-runner-api==${SCRIPT_RUNNER_VERSION} - -COPY ./entrypoint.sh /entrypoint.sh -RUN dos2unix /entrypoint.sh -RUN chmod +x /entrypoint.sh +COPY . /script-runner +RUN pip install /script-runner +RUN rm -rf /script-runner ENV FLASK_APP=script_runner.main:app -ENV SERVER_VERSION=$SERVER_VERSION -ENTRYPOINT [ "/entrypoint.sh" ] +CMD "python3 -m gunicorn.app.wsgiapp --timeout 240 --bind 0.0.0.0:${PORT} --access-logfile - --error-logfile - --workers 4 ${FLASK_APP}" diff --git a/docker/Dockerfile.example b/docker/Dockerfile.example index 56f3e89..f4e354c 100644 --- a/docker/Dockerfile.example +++ b/docker/Dockerfile.example @@ -1,7 +1,6 @@ FROM rocker/verse:3.6.3 ARG SERVER_VERSION=local+container -ARG SCRIPT_RUNNER_VERSION=local+container #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Install extra *nix utils @@ -63,13 +62,13 @@ RUN git clone git://github.com/lab-grid/swabseq-analysis /app # Python Env WORKDIR /app -RUN pip3 install \ - pandas \ - script-runner-api==${SCRIPT_RUNNER_VERSION} +RUN pip3 install pandas -COPY ./entrypoint.sh /entrypoint.sh -RUN dos2unix /entrypoint.sh -RUN chmod +x /entrypoint.sh +COPY . /script-runner +RUN pip3 install /script-runner +RUN rm -rf /script-runner + +COPY ./config.json /app/config.json RUN mkdir /base-rundir RUN wget -qO- https://swabseq-analysis-examples.s3-us-west-1.amazonaws.com/bcls/H3FY3K.tar.gz \ @@ -79,4 +78,4 @@ ENV PYTHONPATH="${RBASE}:${PYTHONPATH}" ENV FLASK_APP=script_runner.main:app ENV SERVER_VERSION=$SERVER_VERSION -ENTRYPOINT [ "/entrypoint.sh" ] +CMD "python3 -m gunicorn.app.wsgiapp --timeout 240 --bind 0.0.0.0:${PORT} --access-logfile - --error-logfile - --workers 4 ${FLASK_APP}" diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh deleted file mode 100644 index a3f9116..0000000 --- a/docker/entrypoint.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env bash - -set -ex - -if [[ ! -z "${BASESPACE_CFG}" ]]; then - echo "${BASESPACE_CFG}" > /root/.basespace/default.cfg -fi - -if [[ -z "${@}" ]]; then - python3 -m gunicorn.app.wsgiapp --timeout 240 --bind 0.0.0.0:${PORT} --access-logfile - --error-logfile - --workers 4 main:app -else - ${@} -fi diff --git a/example.env b/example.env new file mode 100644 index 0000000..8e3495f --- /dev/null +++ b/example.env @@ -0,0 +1,14 @@ +SERVER_NAME=localhost:5000 + +REDIS_PASSWORD=my-redis-password + +AUTH_PROVIDER=none +AUTH0_DOMAIN= +AUTH0_CLIENT_ID= + +AUTH0_API_AUTHORITY= +AUTH0_API_AUDIENCE= + +AUTH0_AUTHORIZATION_URL= +AUTH0_TOKEN_URL= + diff --git a/terraform/aws/main.tf b/terraform/aws/main.tf index a7e45e5..091d847 100644 --- a/terraform/aws/main.tf +++ b/terraform/aws/main.tf @@ -14,7 +14,7 @@ terraform { # IAM ------------------------------------------------------------------------- resource "aws_iam_role" "labflow_role" { - name = "${input.stack_name}-role" + name = "${var.stack_name}-role" # May be necessary: https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role # force_detach_policies = true @@ -47,7 +47,7 @@ EOF module "vpc" { source = "terraform-aws-modules/vpc/aws" - name = "${input.stack_name}-vpc" + name = "${var.stack_name}-vpc" enable_nat_gateway = true enable_dns_hostnames = true @@ -61,7 +61,7 @@ module "vpc" { module "ecs" { source = "terraform-aws-modules/ecs/aws" - name = "${input.stack_name}-ecs" + name = "${var.stack_name}-ecs" container_insights = true