diff --git a/examples/fullstack/README.md b/examples/fullstack/README.md index b968de8..d675e52 100644 --- a/examples/fullstack/README.md +++ b/examples/fullstack/README.md @@ -7,6 +7,12 @@ This is a practical example of a "basic" fullstack application. This applicatio - reverse_proxy - Traefik ingress controller handling reverse proxy for the frontend and backend applications. ## Getting Started + +### Devcontainer +You can run this project via dev containers. First you will need to ensure that you have the [VSCode dev containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) + +Once that is installed you can simply open this folder in VSCode. After a few seconds it should prompt you to reopen in a dev container. If not, you can use the Command pallete and search for `Dev Containers: Open Folder in Dev Container` + Clone the repo and `cd` into the `compose` directory. ```shell @@ -14,7 +20,7 @@ cp backend/.env.example backend/.env docker compose up ``` -The first time you run `docker compose up` it may take a few minutes as Docker will need to build images for the frontend and backend. Also there are some database migrations and seed data that need to happen. Those are handled by `backend/dev-entrypoint.sh`. This is handled for you automatically since it is baked into the image. Once everything is up you should be able to access the frontend at [http://app.docker.localhost:8888]() and the backend at [http://app.docker.localhost:8888/api]() +The first time you run `docker compose up` it may take a few minutes as Docker will need to build images for the frontend and backend. Also there are some database migrations and seed data that need to happen. Those are handled by `backend/entrypoint.sh`. This is handled for you automatically since it is baked into the image. Once everything is up you should be able to access the frontend at [http://app.docker.localhost:8888]() and the backend at [http://app.docker.localhost:8888/api]() ![](./homepage.png) diff --git a/examples/fullstack/backend/Dockerfile b/examples/fullstack/backend/Dockerfile index dd21237..d7cae8e 100644 --- a/examples/fullstack/backend/Dockerfile +++ b/examples/fullstack/backend/Dockerfile @@ -13,7 +13,7 @@ RUN npm ci FROM deps AS develop WORKDIR /app/backend -COPY dev-entrypoint.sh /entrypoint.sh +COPY entrypoint.sh /entrypoint.sh COPY .env.example /app/backend/.env RUN chmod +x /entrypoint.sh ENV NODE_ENV=development diff --git a/examples/fullstack/backend/entrypoint.sh b/examples/fullstack/backend/entrypoint.sh index bb613e5..e1fbaba 100755 --- a/examples/fullstack/backend/entrypoint.sh +++ b/examples/fullstack/backend/entrypoint.sh @@ -1,6 +1,7 @@ #!/bin/sh cd /app/backend +cp .env.example .env echo "starting up..." node ace generate:key diff --git a/examples/fullstack/compose.yml b/examples/fullstack/compose.yml index 3fdf2a7..9cf0941 100644 --- a/examples/fullstack/compose.yml +++ b/examples/fullstack/compose.yml @@ -27,8 +27,6 @@ services: - "traefik.http.middlewares.strip-api-prefix.stripprefix.prefixes=/api" - "traefik.http.routers.backend.rule=Host(`app.docker.localhost`) && PathPrefix(`/api`)" - "traefik.http.routers.backend.middlewares=strip-api-prefix@docker" - env_file: - - ./backend/.env depends_on: db: condition: service_healthy