Skip to content

Commit 6643533

Browse files
committed
frontend service
1 parent 0d5b10e commit 6643533

File tree

4 files changed

+31
-21
lines changed

4 files changed

+31
-21
lines changed

README.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Check [Environment variables](#environment-variables) section for more informati
4444
> Our example is based on [backend.starters.dev-website](https://github.com/starters-dev/backend.starters.dev-website) repo.
4545
4646
```bash
47-
> git clone https://github.com/starters-dev/backend.starters.dev-website services/website
47+
> git clone https://github.com/starters-dev/backend.starters.dev-website services/frontend
4848
```
4949

5050
5. Build and run
@@ -55,11 +55,23 @@ Check [Environment variables](#environment-variables) section for more informati
5555

5656
It will setup everything, including https certificates, and will start Docker Compose services in the background.
5757

58+
## Structure
59+
60+
The folder structure is pretty simple but makes you reuse and write less boilerplate code.
61+
62+
- `docker-compose.main.yml` - main Docker Compose file with DNS challence, ACME and ports configuration.
63+
- `build.sh` - `build` script that runs `setup` script with all scripts under `run/services` folder, builds and runs Docker images in background.
64+
- `.env` - list of environment variables.
65+
- `run/` - folder with general bash scripts.
66+
- `run/services/` - folder with bash scripts for a specific service.
67+
- `services/` - folder with Docker services files. For example, if you have `redis` service, then you would have `services/docker-compose.redis.yml` with specific configuration for `redis` service. Or if your service is a frontend app, then you'll need to clone it to `services/frontend/` and create `services/docker-compose.frontend.yml`.
68+
- `services/your-service/` - folder with your service, for ex. `frontend`.
69+
5870
## What's inside
5971

60-
This setup is using [Traefik](https://github.com/traefik/traefik), the cloud native application proxy, that simplifies the process of getting `https` certificates and the way to describe services.
72+
The setup uses [Traefik](https://github.com/traefik/traefik), the cloud native application proxy, to simplify the process of getting `https` certificates and the way to describe services.
6173

62-
You can always delete existing (if you don't need them) or add your own services by following the same structure.
74+
You can always delete existing (if you don't need them) or add your own services, just make sure to apply necessary changes.
6375

6476
### Services
6577

build.sh

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,4 @@ do
99
done
1010

1111
# -- building containers
12-
# docker-compose $DC_FILES build && docker-compose $DC_FILES up -d
13-
14-
echo $DC_FILES
12+
docker-compose $DC_FILES build && docker-compose $DC_FILES up -d
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
version: "3.7"
2+
3+
services:
4+
frontend:
5+
build: ./frontend
6+
restart: always
7+
labels:
8+
- "traefik.enable=true"
9+
- "traefik.http.routers.frontend.rule=Host(`backend.${DOMAIN_NAME}`)"
10+
- "traefik.http.routers.frontend.entryPoints=http"
11+
- "traefik.http.routers.frontend.middlewares=https_redirect"
12+
- "traefik.http.middlewares.https_redirect.redirectscheme.scheme=https"
13+
- "traefik.http.routers.frontend_tls.rule=Host(`backend.${DOMAIN_NAME}`)"
14+
- "traefik.http.routers.frontend_tls.entryPoints=https"
15+
- "traefik.http.routers.frontend_tls.tls.certresolver=mydnschallenge"

services/docker-compose.website.yml

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)