Skip to content

Commit

Permalink
adding readme and service name and image tag option
Browse files Browse the repository at this point in the history
  • Loading branch information
havok2063 committed Feb 22, 2024
1 parent 07535ce commit c2052bb
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 4 deletions.
7 changes: 4 additions & 3 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ RUN apt-get update && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

# Define an argument for the Git tag, defaulting to "main"
ARG MARVIN_TAG=main

# Clone the repository and checkout the specific tag
RUN git clone https://github.com/sdss/marvin.git /app && \
git checkout docker
#COPY . /app

git checkout ${MARVIN_TAG}

# Install any needed packages
RUN pip install --no-cache-dir ".[web,db]"
Expand Down
46 changes: 46 additions & 0 deletions docker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@


# Marvin Docker

Describes the setup of a containerized system hosting the Marvin
web application.


## Initial Setup

There are two bind mounts:

- The SDSS SAS filesystem
- The host machine pgpass config file

1. Set a `SAS_BASE_DIR` environment variable that points to the
top level directory of the SDSS SAS filesystem.

2. Create or check that a pgpass config file exists at `$HOME/.pgpass`, which contains the manga database connection string info `host.docker.internal:5432:manga:marvin:(password)`. Replace the `(password)` with the local database password.

The marvin docker setup attempts to connect to the local host machine postgres database directly using `host.docker.internal`


## Run docker compose

All commands are relative to within the docker folder. From the top-level repo, run `cd docker`

To build and run the docker compose system:
```bash
docker compose up
```
To force a build, you can do: `docker compose up --build`

Navigate to `http://localhost:8080/marvin/`.

To bring the system down:
```bash
docker compose down
```

The docker compose system starts three services:
- Marvin Webapp - the backend web application, mounted to port 8000
- Nginx - the nginx web service, mounted to port 8080
- Redis - a redis database for caching

The final web application is available at `localhost:8080/marvin`
7 changes: 6 additions & 1 deletion docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
version: '3.9'
name: marvin
services:
nginx:
container_name: nginx
Expand Down Expand Up @@ -33,7 +34,11 @@ services:

marvin:
container_name: marvin
image: marvin:latest
build:
context: .
args:
MARVIN_TAG: ${MARVIN_TAG:-main}
image: marvin:${MARVIN_TAG:-latest}
ports:
- 8000:8000
volumes:
Expand Down

0 comments on commit c2052bb

Please sign in to comment.