From b173f2733aa392ce3542617a06825a2731fe0e94 Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Thu, 19 Oct 2023 13:23:58 -0400 Subject: [PATCH 01/12] Remove deprecated Docker compose deployment files --- andromeda-ui/Dockerfile | 9 --------- andromeda/Dockerfile | 10 ---------- docker-compose.yml | 33 --------------------------------- 3 files changed, 52 deletions(-) delete mode 100644 andromeda-ui/Dockerfile delete mode 100644 andromeda/Dockerfile delete mode 100644 docker-compose.yml diff --git a/andromeda-ui/Dockerfile b/andromeda-ui/Dockerfile deleted file mode 100644 index bd28011..0000000 --- a/andromeda-ui/Dockerfile +++ /dev/null @@ -1,9 +0,0 @@ -FROM node:18.16.0 as builder -WORKDIR /src -COPY package.json ./ -RUN npm install -COPY . . -RUN npm run build -FROM nginx:stable -COPY --from=builder /src/out /data/www -COPY nginx.conf /etc/nginx/ \ No newline at end of file diff --git a/andromeda/Dockerfile b/andromeda/Dockerfile deleted file mode 100644 index c8bdc44..0000000 --- a/andromeda/Dockerfile +++ /dev/null @@ -1,10 +0,0 @@ -FROM python:3.11 - -COPY ./requirements.txt /tmp/requirements.txt -WORKDIR /tmp -RUN pip3 install gunicorn && pip3 install -r requirements.txt - -COPY . /api -WORKDIR /api - -CMD /api/run.sh diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 100644 index 70739f3..0000000 --- a/docker-compose.yml +++ /dev/null @@ -1,33 +0,0 @@ -version: "3" - -services: - api: - container_name: backend - restart: always - build: ./andromeda - tmpfs: /api/uploads - networks: - - apinetwork - expose: - - "5000" - environment: - - BACKEND_WORKERS=${BACKEND_WORKERS} - - ANDROMEDA_RGB_SATELLITE_URL=${ANDROMEDA_RGB_SATELLITE_URL} - - ANDROMEDA_LANDCOVER_URL=${ANDROMEDA_LANDCOVER_URL} - - nginx: - container_name: frontend - restart: always - build: ./andromeda-ui - networks: - - apinetwork - expose: - - "8080" - ports: - - "80:80" - - "443:443" - volumes: - - /etc/letsencrypt:/etc/letsencrypt - -networks: - apinetwork: From d39a8684f0d2fefed6fcf9e76c449aaab38f1469 Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Thu, 19 Oct 2023 14:03:50 -0400 Subject: [PATCH 02/12] Detail our Docker/HF deployment The Docker deployment on Hugging Face does not generalize well since HF handles encryption. For now, we simply link to resources someone might consider if they would like to deploy into a different environment. --- README.md | 71 ++++++++++++++++++++++++------------------------------- 1 file changed, 31 insertions(+), 40 deletions(-) diff --git a/README.md b/README.md index 39b147d..ea9d921 100644 --- a/README.md +++ b/README.md @@ -2,61 +2,52 @@ Andromeda is a website that allows a user to perform dimensional reduction on an uploaded CSV file. ## Requirements -Deployment requires [docker-compose](https://www.docker.com/). +Deployment requires [Docker](https://www.docker.com/). Development requires [python3](https://www.python.org/) and [nodejs](https://nodejs.org/). ## Deployment -To deploy the website on a machine running docker run the following commands: +Our primary deployment environment is [Hugging Face Spaces](https://huggingface.co/spaces/imageomics/Andromeda). +To deploy the website on a machine running Docker run the following commands: +1. Clone our Hugging Face Andromeda repository, which uses this GitHub repository as a submodule. ```bash -git clone https://github.com/Imageomics/Andromeda.git -cd Andromeda/ -cp example.env .env -docker-compose up -d +git clone --recurse-submodules git@hf.co/spaces/imageomics/Andromeda # or use https://huggingface.co/spaces/imageomics/Andromeda ``` -The `-d` flag runs the website in the background. For troubleshooting remove this flag to more easily monitor the deployment. - -Once the website finishes launching the website will be available on port 80: [http://localhost](http://localhost). -Part of the deployment builds the docker containers used by the website, so it may take a few minutes to finish deployment. -To stop the app run `docker-compose down`. - -Settings for the app can be changed in `.env`. -Options for `.env`: -- BACKEND_WORKERS - number of [workers used by gunicorn](https://docs.gunicorn.org/en/latest/run.html#commonly-used-arguments) -- ANDROMEDA_RGB_SATELLITE_URL - URL pointing to a CSV file for joining RGB data -- ANDROMEDA_LANDCOVER_URL - Optional URL pointing to a CSV file for joining Landcover data - - -### Certbot Setup on AWS -Certificates can be installed to the EC2 VM using Certbot with Nginx on pip following [EFF instructions](https://certbot.eff.org/instructions?ws=nginx&os=pip). +(optional) If you want to use or test a different branch of the Andromeda repository, checkout the desired branch. +```bash +cd Andromeda/Andromeda +git checkout +cd .. +``` +2. Build the Docker image. ```bash -sudo python3 -m venv /opt/certbot/ -sudo /opt/certbot/bin/pip install --upgrade pip -sudo /opt/certbot/bin/pip install certbot certbot-nginx -sudo ln -s /opt/certbot/bin/certbot /usr/bin/certbot +docker image build -t andromeda . ``` -And to install Nginx on the Amazon Linux 2023 (following [instructions](https://awswithatiq.com/how-to-install-nginx-in-amazon-linux-2023/)) and run Certbot: +3. Run the Docker image. ```bash -docker-compose down -sudo dnf update -y -sudo dnf install nginx -y -sudo systemctl start nginx -sudo certbot certonly --nginx +docker container run -p 7860:7860 andromeda ``` -Following prompted agreements, registration, and specifying andromeda.imageomics.org, the certificates are installed to: -Certificate: `/etc/letsencrypt/live/andromeda.imageomics.org/fullchain.pem` +While Hugging Face handles SSL encryption automatically, other deployment environments require SSL to be set up manually. One common approach is using a reverse proxy like Nginx. Below are some resources and tutorials that provide guidance on setting up SSL with Nginx in a Docker environment: -Key: `/etc/letsencrypt/live/andromeda.imageomics.org/privkey.pem` +- [Configure HTTPS for an Nginx Docker Container (Stackify)](https://stackify.com/configure-nginx-docker-container-https)​ +- [Setup SSL with Docker, NGINX and Lets Encrypt (Programonaut)​](https://www.programonaut.com/setup-ssl-with-docker-nginx-and-lets-encrypt) +- [Set up SSL on Docker, Nginx Container and Let's Encrypt (SSLWiki)]​(https://sslwiki.org/docker-nginx-letsencrypt) +- [Install TLS/SSL on Docker Nginx Container With Let’s Encrypt (Dev.to)](https://dev.to/techworldzone/how-to-install-tls-ssl-on-docker-nginx-container-with-let-s-encrypt-5a3n) +- [NGINX Docker with SSL Encryption (Self-signed) by Mike Polinowski​](https://mpolinowski.github.io/nginx-docker-ssl) -Finally, shut down Nginx on the system to avoid interference with the container: -```bash -sudo systemctl stop nginx -docker-compose up -d -``` +These tutorials cover a range of setups including self-signed certificates, Let's Encrypt, and Certbot. Choose the one (or more) that aligns well with your deployment scenario. + +Settings for the app can be changed in `.env`. +Options for `.env`: +- BACKEND_WORKERS - number of [workers used by gunicorn](https://docs.gunicorn.org/en/latest/run.html#commonly-used-arguments) +- ANDROMEDA_RGB_SATELLITE_URL - URL pointing to a CSV file for joining RGB data +- ANDROMEDA_LANDCOVER_URL - Optional URL pointing to a CSV file for joining Landcover data ## Development -To run the website locally without using docker requires two terminal sessions. +You may use the Docker image for development as described above, but it is not required. + +To run the website locally without using Docker requires two terminal sessions. 1. Python Flask Backend API Server 2. Frontend nodejs/react development server From 9eacb49bd106c5340dbd53ef124846ad44492854 Mon Sep 17 00:00:00 2001 From: Matt Thompson <31709066+thompsonmj@users.noreply.github.com> Date: Thu, 19 Oct 2023 17:21:11 -0400 Subject: [PATCH 03/12] Fix broken hyperlinks. --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index ea9d921..e6be54c 100644 --- a/README.md +++ b/README.md @@ -30,11 +30,11 @@ docker container run -p 7860:7860 andromeda While Hugging Face handles SSL encryption automatically, other deployment environments require SSL to be set up manually. One common approach is using a reverse proxy like Nginx. Below are some resources and tutorials that provide guidance on setting up SSL with Nginx in a Docker environment: -- [Configure HTTPS for an Nginx Docker Container (Stackify)](https://stackify.com/configure-nginx-docker-container-https)​ -- [Setup SSL with Docker, NGINX and Lets Encrypt (Programonaut)​](https://www.programonaut.com/setup-ssl-with-docker-nginx-and-lets-encrypt) -- [Set up SSL on Docker, Nginx Container and Let's Encrypt (SSLWiki)]​(https://sslwiki.org/docker-nginx-letsencrypt) -- [Install TLS/SSL on Docker Nginx Container With Let’s Encrypt (Dev.to)](https://dev.to/techworldzone/how-to-install-tls-ssl-on-docker-nginx-container-with-let-s-encrypt-5a3n) -- [NGINX Docker with SSL Encryption (Self-signed) by Mike Polinowski​](https://mpolinowski.github.io/nginx-docker-ssl) +- [Configure HTTPS for an Nginx Docker Container (Stackify)](https://stackify.com/how-to-configure-https-for-an-nginx-docker-container/)​ +- [Setup SSL with Docker, NGINX and Lets Encrypt (Programonaut)​](https://www.programonaut.com/setup-ssl-with-docker-nginx-and-lets-encrypt/) +- [Set up SSL on Docker, Nginx Container and Let's Encrypt (SSLWiki)](https://sslwiki.org/set-up-ssl-on-docker-nginx-and-lets-encrypt/) +- [Install TLS/SSL on Docker Nginx Container With Let’s Encrypt (Dev.to)](https://dev.to/macelux/how-to-install-tlsssl-on-docker-nginx-container-with-lets-encrypt-34c5) +- [NGINX Docker with SSL Encryption (Self-signed) by Mike Polinowski​](https://mpolinowski.github.io/docs/DevOps/NGINX/2020-08-27--nginx-docker-ssl-certs-self-signed/2020-08-27/) These tutorials cover a range of setups including self-signed certificates, Let's Encrypt, and Certbot. Choose the one (or more) that aligns well with your deployment scenario. From 5addafe1a6d250f741f98f84c827405d26678352 Mon Sep 17 00:00:00 2001 From: Matt Thompson <31709066+thompsonmj@users.noreply.github.com> Date: Fri, 20 Oct 2023 15:09:28 -0400 Subject: [PATCH 04/12] Remove unneeded landcover env variable. Co-authored-by: Elizabeth Campolongo <38985481+egrace479@users.noreply.github.com> --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index e6be54c..3f17549 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,6 @@ Settings for the app can be changed in `.env`. Options for `.env`: - BACKEND_WORKERS - number of [workers used by gunicorn](https://docs.gunicorn.org/en/latest/run.html#commonly-used-arguments) - ANDROMEDA_RGB_SATELLITE_URL - URL pointing to a CSV file for joining RGB data -- ANDROMEDA_LANDCOVER_URL - Optional URL pointing to a CSV file for joining Landcover data ## Development You may use the Docker image for development as described above, but it is not required. From ed4561d9fb06690f8739f39777473620d7c59584 Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Mon, 23 Oct 2023 10:13:28 -0400 Subject: [PATCH 05/12] Set up HF deployment in GH repo --- Dockerfile | 24 ++++++++++++++++++++++++ app.py | 14 ++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 Dockerfile create mode 100644 app.py diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..d16ca1c --- /dev/null +++ b/Dockerfile @@ -0,0 +1,24 @@ +FROM node:18.16.0 as builder +WORKDIR /src +COPY ./andromeda-ui/package.json ./ +RUN npm install +COPY ./andromeda-ui/. . +RUN npm run build + +FROM python:3.11 + +COPY ./andromeda/requirements.txt /tmp/requirements.txt +WORKDIR /tmp +RUN pip3 install gunicorn && pip3 install -r requirements.txt + +COPY ./andromeda/. /api +COPY ./app.py /api/app.py +COPY --from=builder /src/out /api/static +WORKDIR /api + +# fix since root home directory is read only in HF +RUN mkdir /tmp/home +RUN chmod a+w /tmp/home +ENV XDG_DATA_HOME=/tmp/home + +CMD python app.py \ No newline at end of file diff --git a/app.py b/app.py new file mode 100644 index 0000000..ceb9f8d --- /dev/null +++ b/app.py @@ -0,0 +1,14 @@ +# Adds logic to serve static html for running within huggingface +from flask import send_from_directory, request +from main import app + +@app.errorhandler(404) +def page_not_found(e): + path = request.path.lstrip('/') + if path == '': + path = 'index.html' + print(path) + return send_from_directory('static', path) + +if __name__ == '__main__': + app.run(host="0.0.0.0", port=7860) \ No newline at end of file From 77baf4e5a328283f7e34c86be14ed849bc581569 Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Mon, 23 Oct 2023 13:00:34 -0400 Subject: [PATCH 06/12] Configure action for auto Docker image build on release --- .github/workflows/deploy-image.yml | 52 ++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 .github/workflows/deploy-image.yml diff --git a/.github/workflows/deploy-image.yml b/.github/workflows/deploy-image.yml new file mode 100644 index 0000000..5d56fed --- /dev/null +++ b/.github/workflows/deploy-image.yml @@ -0,0 +1,52 @@ +name: Create and publish a Docker image +# Reference: https://docs.github.com/en/actions/publishing-packages/publishing-docker-images#publishing-images-to-github-packages + +# Configures this workflow to run every time a release is published. +on: + release: + types: [published] + +# Defines two custom environment variables for the workflow. These are used for the Container registry domain, and a name for the Docker image that this workflow builds. +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +# There is a single job in this workflow. It's configured to run on the latest available version of Ubuntu. +jobs: + build-and-push-image: + runs-on: ubuntu-latest + # Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job. + permissions: + contents: read + packages: write + # + steps: + - name: Checkout repository + uses: actions/checkout@v4 + # Uses the `docker/login-action` action to log in to the Container registry registry using the account and password that will publish the packages. Once published, the packages are scoped to the account defined here. + - name: Log in to the Container registry + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + # This step uses [docker/metadata-action](https://github.com/docker/metadata-action#about) to extract tags and labels that will be applied to the specified image. The `id` "meta" allows the output of this step to be referenced in a subsequent step. The `images` value provides the base name for the tags and labels. + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=semver,pattern={{major}}.{{minor}}.{{patch}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{major}} + # This step uses the `docker/build-push-action` action to build the image, based on your repository's `Dockerfile`. If the build succeeds, it pushes the image to GitHub Packages. + # It uses the `context` parameter to define the build's context as the set of files located in the specified path. For more information, see "[Usage](https://github.com/docker/build-push-action#usage)" in the README of the `docker/build-push-action` repository. + # It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step. + - name: Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} From d9c66bd2cc997c01d029f10e8c47d1bcd0d45e1d Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Mon, 23 Oct 2023 20:42:44 -0400 Subject: [PATCH 07/12] Use gunicorn in the container --- Dockerfile | 2 +- andromeda/run.sh | 2 +- andromeda/wsgi.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index d16ca1c..635c415 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,4 +21,4 @@ RUN mkdir /tmp/home RUN chmod a+w /tmp/home ENV XDG_DATA_HOME=/tmp/home -CMD python app.py \ No newline at end of file +CMD /api/run.sh \ No newline at end of file diff --git a/andromeda/run.sh b/andromeda/run.sh index dabe8a4..43064b1 100755 --- a/andromeda/run.sh +++ b/andromeda/run.sh @@ -1,2 +1,2 @@ #!/bin/bash -gunicorn -w ${BACKEND_WORKERS:=4} -b :5000 -t 360 wsgi:app +gunicorn -w ${BACKEND_WORKERS:=4} -b :7860 -t 360 wsgi:app diff --git a/andromeda/wsgi.py b/andromeda/wsgi.py index f1ea2b4..6026b0f 100644 --- a/andromeda/wsgi.py +++ b/andromeda/wsgi.py @@ -1,4 +1,4 @@ -from main import app +from app import app if __name__ == "__main__": app.run() From e6f7a985a2a3ad2cdb911771ca973a8abfa20762 Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Mon, 23 Oct 2023 20:53:32 -0400 Subject: [PATCH 08/12] Describe GitHub-centric container deployment on HF --- README.md | 40 +++++++++++++++++++--------------------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 3f17549..2d37773 100644 --- a/README.md +++ b/README.md @@ -8,43 +8,41 @@ Development requires [python3](https://www.python.org/) and [nodejs](https://nod ## Deployment Our primary deployment environment is [Hugging Face Spaces](https://huggingface.co/spaces/imageomics/Andromeda). -To deploy the website on a machine running Docker run the following commands: -1. Clone our Hugging Face Andromeda repository, which uses this GitHub repository as a submodule. -```bash -git clone --recurse-submodules git@hf.co/spaces/imageomics/Andromeda # or use https://huggingface.co/spaces/imageomics/Andromeda -``` -(optional) If you want to use or test a different branch of the Andromeda repository, checkout the desired branch. -```bash -cd Andromeda/Andromeda -git checkout -cd .. -``` + +To build a Docker image from the source code and deploy the container: + +1. Clone this repository and navigate into it. + 2. Build the Docker image. ```bash docker image build -t andromeda . ``` -3. Run the Docker image. + +3. Optionally, set your environment variables in `.env`. See the section below for more information. ```bash -docker container run -p 7860:7860 andromeda +cp example.env .env # uses the provided example environment variables ``` -While Hugging Face handles SSL encryption automatically, other deployment environments require SSL to be set up manually. One common approach is using a reverse proxy like Nginx. Below are some resources and tutorials that provide guidance on setting up SSL with Nginx in a Docker environment: +4. Run the Docker container. +```bash +docker container run --env-file .env -p 7860:7860 andromeda +``` -- [Configure HTTPS for an Nginx Docker Container (Stackify)](https://stackify.com/how-to-configure-https-for-an-nginx-docker-container/)​ -- [Setup SSL with Docker, NGINX and Lets Encrypt (Programonaut)​](https://www.programonaut.com/setup-ssl-with-docker-nginx-and-lets-encrypt/) -- [Set up SSL on Docker, Nginx Container and Let's Encrypt (SSLWiki)](https://sslwiki.org/set-up-ssl-on-docker-nginx-and-lets-encrypt/) -- [Install TLS/SSL on Docker Nginx Container With Let’s Encrypt (Dev.to)](https://dev.to/macelux/how-to-install-tlsssl-on-docker-nginx-container-with-lets-encrypt-34c5) -- [NGINX Docker with SSL Encryption (Self-signed) by Mike Polinowski​](https://mpolinowski.github.io/docs/DevOps/NGINX/2020-08-27--nginx-docker-ssl-certs-self-signed/2020-08-27/) +5. Prepare a simple Dockerfile in a Hugging Face Space. For example: +```Dockerfile +FROM ghcr.io/Imageomics/Andromeda:latest +``` -These tutorials cover a range of setups including self-signed certificates, Let's Encrypt, and Certbot. Choose the one (or more) that aligns well with your deployment scenario. +Hugging Face handles SSL encryption automatically. Deploying in another environment may require additional configuration; previous configurations are discussed in [Prior Configurations](https://github.com/Imageomics/Andromeda/wiki/Prior-Configurations). +If you are interested in running your own QUEST-like class with your own satellite data CSV, you could create a few line Dockerfile, add their CSV, and host their own version Andromeda on their HF account. Settings for the app can be changed in `.env`. Options for `.env`: - BACKEND_WORKERS - number of [workers used by gunicorn](https://docs.gunicorn.org/en/latest/run.html#commonly-used-arguments) - ANDROMEDA_RGB_SATELLITE_URL - URL pointing to a CSV file for joining RGB data ## Development -You may use the Docker image for development as described above, but it is not required. +You may use the Docker image for testing during development as described above, but it is not required. To run the website locally without using Docker requires two terminal sessions. 1. Python Flask Backend API Server From c755f4e1abee5edffbf907272a32b22715d20723 Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Tue, 24 Oct 2023 09:29:57 -0400 Subject: [PATCH 09/12] Move app.py into andromeda/ to keep code together --- Dockerfile | 1 - app.py => andromeda/app.py | 0 2 files changed, 1 deletion(-) rename app.py => andromeda/app.py (100%) diff --git a/Dockerfile b/Dockerfile index 635c415..f5388c4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,7 +12,6 @@ WORKDIR /tmp RUN pip3 install gunicorn && pip3 install -r requirements.txt COPY ./andromeda/. /api -COPY ./app.py /api/app.py COPY --from=builder /src/out /api/static WORKDIR /api diff --git a/app.py b/andromeda/app.py similarity index 100% rename from app.py rename to andromeda/app.py From 8e39c2642b48f7afc55ddcf90b68aaf3aa9040bc Mon Sep 17 00:00:00 2001 From: Matt Thompson <31709066+thompsonmj@users.noreply.github.com> Date: Tue, 24 Oct 2023 09:43:16 -0400 Subject: [PATCH 10/12] Fix README types Co-authored-by: Elizabeth Campolongo <38985481+egrace479@users.noreply.github.com> --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2d37773..eca9966 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ FROM ghcr.io/Imageomics/Andromeda:latest Hugging Face handles SSL encryption automatically. Deploying in another environment may require additional configuration; previous configurations are discussed in [Prior Configurations](https://github.com/Imageomics/Andromeda/wiki/Prior-Configurations). -If you are interested in running your own QUEST-like class with your own satellite data CSV, you could create a few line Dockerfile, add their CSV, and host their own version Andromeda on their HF account. +If you are interested in running your own QUEST-like class with your own satellite data CSV, you could create a few line Dockerfile, add your CSV, and host your own version Andromeda on your HF account. Settings for the app can be changed in `.env`. Options for `.env`: - BACKEND_WORKERS - number of [workers used by gunicorn](https://docs.gunicorn.org/en/latest/run.html#commonly-used-arguments) From 077fed7a5bf3f60a63d4310d0407e64202b29ec7 Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Tue, 24 Oct 2023 12:13:14 -0400 Subject: [PATCH 11/12] Minor cleanup --- Dockerfile | 2 +- andromeda/app.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index f5388c4..a34ec8b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,4 +20,4 @@ RUN mkdir /tmp/home RUN chmod a+w /tmp/home ENV XDG_DATA_HOME=/tmp/home -CMD /api/run.sh \ No newline at end of file +CMD /api/run.sh diff --git a/andromeda/app.py b/andromeda/app.py index ceb9f8d..9fda923 100644 --- a/andromeda/app.py +++ b/andromeda/app.py @@ -7,8 +7,8 @@ def page_not_found(e): path = request.path.lstrip('/') if path == '': path = 'index.html' - print(path) return send_from_directory('static', path) if __name__ == '__main__': - app.run(host="0.0.0.0", port=7860) \ No newline at end of file + app.run(host="0.0.0.0", port=7860) + \ No newline at end of file From 35de7d962c4901a40cf27862d9e8a4abf7b190c6 Mon Sep 17 00:00:00 2001 From: John Bradley Date: Wed, 1 Nov 2023 13:30:53 -0400 Subject: [PATCH 12/12] Remove docker development from README Moved docker development instructions to the wiki. --- README.md | 37 +++++-------------------------------- 1 file changed, 5 insertions(+), 32 deletions(-) diff --git a/README.md b/README.md index eca9966..7c2deb0 100644 --- a/README.md +++ b/README.md @@ -8,38 +8,9 @@ Development requires [python3](https://www.python.org/) and [nodejs](https://nod ## Deployment Our primary deployment environment is [Hugging Face Spaces](https://huggingface.co/spaces/imageomics/Andromeda). - -To build a Docker image from the source code and deploy the container: - -1. Clone this repository and navigate into it. - -2. Build the Docker image. -```bash -docker image build -t andromeda . -``` - -3. Optionally, set your environment variables in `.env`. See the section below for more information. -```bash -cp example.env .env # uses the provided example environment variables -``` - -4. Run the Docker container. -```bash -docker container run --env-file .env -p 7860:7860 andromeda -``` - -5. Prepare a simple Dockerfile in a Hugging Face Space. For example: -```Dockerfile -FROM ghcr.io/Imageomics/Andromeda:latest -``` - -Hugging Face handles SSL encryption automatically. Deploying in another environment may require additional configuration; previous configurations are discussed in [Prior Configurations](https://github.com/Imageomics/Andromeda/wiki/Prior-Configurations). - -If you are interested in running your own QUEST-like class with your own satellite data CSV, you could create a few line Dockerfile, add your CSV, and host your own version Andromeda on your HF account. -Settings for the app can be changed in `.env`. -Options for `.env`: -- BACKEND_WORKERS - number of [workers used by gunicorn](https://docs.gunicorn.org/en/latest/run.html#commonly-used-arguments) -- ANDROMEDA_RGB_SATELLITE_URL - URL pointing to a CSV file for joining RGB data +To deploy a new version change the version in the tag in the [Andromeda Space Dockerfile](https://huggingface.co/spaces/imageomics/Andromeda/blob/main/Dockerfile). +Hugging Face handles SSL encryption automatically. +Deploying in another environment may require additional configuration; previous configurations are discussed in [Prior Configurations](https://github.com/Imageomics/Andromeda/wiki/Prior-Configurations). ## Development You may use the Docker image for testing during development as described above, but it is not required. @@ -48,6 +19,8 @@ To run the website locally without using Docker requires two terminal sessions. 1. Python Flask Backend API Server 2. Frontend nodejs/react development server +For instructions on buliding and running the Docker container see [Developing with Docker](https://github.com/Imageomics/Andromeda/wiki/Developing-with-Docker). + ## Python Backend The python backend consists of a [Flask](https://flask.palletsprojects.com/en/2.3.x/quickstart/#a-minimal-application) REST API server. See the [Andromeda Python README](andromeda/README.md) for instructions on running locally.