diff --git a/README.md b/README.md index c052c7a..1ceb734 100644 --- a/README.md +++ b/README.md @@ -77,6 +77,14 @@ docker compose exec api fastapi dev --host 0.0.0.0 ./src/aross_stations_db/api From here, you can interactively pause at any `breakpoint()` calls in the Python code. + +### UI development + +The instructions below specify starting the stack with the `--profile ui` option. If you +wish to develop in +[the user interface code repository](https://github.com/nsidc/aross-stations-ui), you +should omit that flag and follow the instructions in the UI repo to develop. + @@ -112,7 +120,7 @@ The stack is configured within `compose.yml` and includes containers: * `aross-stations-api`: An HTTP API for accessing data in the database. ```bash -docker compose up --pull=always --detach +docker compose --profile ui up --pull=always --detach ``` > [!IMPORTANT] @@ -203,13 +211,19 @@ You can replace `api` with any other service name, or omit it to view logs for a services. -## View UI +### View UI + +Navigate to `http://localhost:80`. + + +### Experiment in JupyterLab -For now, it's just a Jupyterlab instance with a demo notebook. In your browser, navigate -to `http://localhost:8888`. The password is the same as the database password you set earlier. +This repository provides a demo notebook to experiment with the API. In your browser, +navigate to `http://localhost:8888`. The password is the same as the database password +you set earlier. -This UI will likely be replaced with something more robust. Who knows ;) +## Cleanup ### Shutdown diff --git a/compose.dev.yml b/compose.dev.yml index 46f8b4d..a3c0849 100644 --- a/compose.dev.yml +++ b/compose.dev.yml @@ -7,12 +7,23 @@ x-dev-common: &dev-common services: - ui: - <<: *dev-common - api: <<: *dev-common command: ["dev", "--host", "0.0.0.0", "./src/aross_stations_db/api"] + # NOTE: In place of the above command, which uses the image's default + # `fastapi` entrypoint, you can run the container with no server (using + # "sleep" instead): + # + # entrypoint: "sleep" + # command: ["9999999"] + # + # ... then, you can connect to the container for debugging, e.g. by + # placing a breakpoint in code then interactively running the server + # process: + # docker compose exec api fastapi dev --host 0.0.0.0 ./src/aross_stations_db/api cli: <<: *dev-common + + jupyterlab: + <<: *dev-common diff --git a/compose.yml b/compose.yml index 6faac41..02f239a 100644 --- a/compose.yml +++ b/compose.yml @@ -9,17 +9,12 @@ x-image: &image "nsidc/aross-stations-db" services: ui: - container_name: "aross-stations-jupyterlab" + container_name: "aross-stations-ui" depends_on: ["api"] - image: *image - <<: *common - - entrypoint: "jupyter" - command: ["lab", "--allow-root", "--ip=0.0.0.0"] + image: "nsidc/aross-stations-ui:latest" ports: - - "8888:8888" - environment: - JUPYTER_TOKEN: "${POSTGRES_PASSWORD}" + - "80:80" + profiles: ["ui"] api: @@ -71,7 +66,20 @@ services: environment: AROSS_DATA_BASEDIR: "/data" AROSS_DB_CONNSTR: null - profiles: - # Prevents this "service" from running with `docker compose up`. - # Instead, it's intended to be used like `docker compose run cli --help`. - - "_" + # Prevents this "service" from running with `docker compose up`. + # Instead, it's intended to be used like `docker compose run cli --help`. + profiles: ["_"] + + + jupyterlab: + container_name: "aross-stations-jupyterlab" + depends_on: ["api"] + image: *image + <<: *common + + entrypoint: "jupyter" + command: ["lab", "--allow-root", "--ip=0.0.0.0"] + ports: + - "8888:8888" + environment: + JUPYTER_TOKEN: "${POSTGRES_PASSWORD}"