Simplify startup

This commit is contained in:
Mike Conrad
2025-06-20 13:30:10 -04:00
parent 8e2cd7f9a1
commit b6c684cdd1
4 changed files with 9 additions and 4 deletions

View File

@ -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. - reverse_proxy - Traefik ingress controller handling reverse proxy for the frontend and backend applications.
## Getting Started ## 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. Clone the repo and `cd` into the `compose` directory.
```shell ```shell
@ -14,7 +20,7 @@ cp backend/.env.example backend/.env
docker compose up 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) ![](./homepage.png)

View File

@ -13,7 +13,7 @@ RUN npm ci
FROM deps AS develop FROM deps AS develop
WORKDIR /app/backend WORKDIR /app/backend
COPY dev-entrypoint.sh /entrypoint.sh COPY entrypoint.sh /entrypoint.sh
COPY .env.example /app/backend/.env COPY .env.example /app/backend/.env
RUN chmod +x /entrypoint.sh RUN chmod +x /entrypoint.sh
ENV NODE_ENV=development ENV NODE_ENV=development

View File

@ -1,6 +1,7 @@
#!/bin/sh #!/bin/sh
cd /app/backend cd /app/backend
cp .env.example .env
echo "starting up..." echo "starting up..."
node ace generate:key node ace generate:key

View File

@ -27,8 +27,6 @@ services:
- "traefik.http.middlewares.strip-api-prefix.stripprefix.prefixes=/api" - "traefik.http.middlewares.strip-api-prefix.stripprefix.prefixes=/api"
- "traefik.http.routers.backend.rule=Host(`app.docker.localhost`) && PathPrefix(`/api`)" - "traefik.http.routers.backend.rule=Host(`app.docker.localhost`) && PathPrefix(`/api`)"
- "traefik.http.routers.backend.middlewares=strip-api-prefix@docker" - "traefik.http.routers.backend.middlewares=strip-api-prefix@docker"
env_file:
- ./backend/.env
depends_on: depends_on:
db: db:
condition: service_healthy condition: service_healthy