diff --git a/README.md b/README.md index cda236f..da29ade 100644 --- a/README.md +++ b/README.md @@ -23,61 +23,17 @@ sequenceDiagram FE2-on-NodeServer->>Browser: API Data response ``` -## Install the components: -### [InterNetNews](https://github.com/InterNetNews/inn) will be run in a Docker container: -Also: -* -* -* - -### [FastAPI](https://fastapi.tiangolo.com/)-Server will be run in a Docker container: -From the project root directory - -### NodeServer (Node.js Vue app) -From the project root directory -```bash -cd fe -npm install -``` - ## Run the components For local development and testing, start the INN2 server and FastAPI server with: ```bash docker compose -f docker-compose.debug.yml up ``` - -### InterNetNews server: -For local development and testing, start the INN2 server with: -```bash -docker run --rm -t -p119:119 -p563:563 cclauss/inn -``` - -### FastAPI Python app: -For local development and testing: -```bash -pipenv shell -PYTHONPATH=. fastapi dev --host=0.0.0.0 --port=5001 server/main.py - -open http://localhost:5001 -open http://localhost:5001/docs -``` - -Or docker build and run the FastAPI server in background mode and -follow the logs with: -```bash -docker build --tag=fastapi-server --no-cache --progress=plain . \ - && docker run --detach --publish=5001:5001 fastapi-server \ - && docker logs -f $(docker ps -lq) - -open http://localhost:5001 -open http://localhost:5001/docs -``` - -### FE NodeServer -```bash -cd fe -npm run dev --host=0.0.0.0 -``` +* [InterNetNews](https://github.com/InterNetNews/inn) (INN) backend that houses the metadata. + * + * + * +* [FastAPI](https://fastapi.tiangolo.com/)-Server middle tier that connects the INN to the frontend. +* [FE2](./FE2/README.md) user interface that connects to the FastAPI-Server. ### FE2 NodeServer ```bash diff --git a/fe2/README.md b/fe2/README.md index 39a6a0c..aa5b95d 100644 --- a/fe2/README.md +++ b/fe2/README.md @@ -10,6 +10,15 @@ should probably be a Node.js server process that can handle 4xx and 5xx errors. After we have communication running from FE2 to Server to INN2, we can reevaluate where further code changes should be focused. +```bash +cd fe2 +npm ci +npm run start +# Wait for `webpack x.y.z compiled successfully` +open http://localhost:4000/imls +``` + + ## % `cd fe2 && npm run` ``` diff --git a/server/README.md b/server/README.md index 01ea469..720a79b 100644 --- a/server/README.md +++ b/server/README.md @@ -1,11 +1,17 @@ # FastAPI server ## A backend for the FE2 user interface -Build and run the FastAPI server in background mode and follow the logs. +### Using Docker + +Docker build and run the FastAPI server in background mode and +follow the logs with: ```bash docker build --tag=fastapi-server --no-cache --progress=plain . \ && docker run --detach --publish=5001:5001 fastapi-server \ && docker logs -f $(docker ps -lq) + +open http://localhost:5001 +open http://localhost:5001/docs ``` Options: * Remove `--no-cache` to accelerate rebuilds. @@ -18,3 +24,14 @@ To kill the background container, run: ```bash docker kill $(docker ps -lq) ``` + +### Without Docker + +For local development and testing: +```bash +pipenv shell +PYTHONPATH=. fastapi dev --host=0.0.0.0 --port=5001 server/main.py + +open http://localhost:5001 +open http://localhost:5001/docs +``` diff --git a/server/main.py b/server/main.py index 776c6af..c2682af 100644 --- a/server/main.py +++ b/server/main.py @@ -1,3 +1,5 @@ +import os + from fastapi import FastAPI from fastapi.middleware.cors import CORSMiddleware from fastapi.staticfiles import StaticFiles @@ -16,6 +18,10 @@ allow_headers=["*"], ) +# If we are not running in Continuous Integration then enable the INN local.test group. +if not os.getenv("CI"): # Not running in Continuous Integration + ome_node.DEFAULT_NEWSGROUPS.remove(("local.test", "Local test group")) + @app.get("/api/list") async def main() -> list[Channel]: