Skip to content

Commit d86b21a

Browse files
committed
docs: updating readme
1 parent 12c6fb7 commit d86b21a

File tree

1 file changed

+53
-74
lines changed

1 file changed

+53
-74
lines changed

README.md

Lines changed: 53 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -131,101 +131,80 @@ If you **like/use** this project, please consider ⭐️ **starring** it. Thanks
131131
Currently, on macOS you may need to enter password several times to allow mkcert to install root certificate.
132132
This is a one-time operation and details can be found in this upstream [issue](https://github.com/FiloSottile/mkcert/issues/415).
133133

134-
<br>
135-
136-
## 💻 Usage
137-
138-
### → Running with a blank shared domain segment
139-
140-
Leave the `SHARED_DOMAIN_SEGMENT` blank to run shared services under the first level domain. For example:
141-
142-
| Address |
143-
|-----------------|
144-
| router.docker |
145-
| pg-admin.docker |
146-
| ui.docker |
147-
| etc. |
148-
149-
<br>
150-
151-
### → Running with a default or custom shared domain segment
152-
153-
Set the segment to run shared services under a subdomain: `SHARED_DOMAIN_SEGMENT=.wod`. Services will run under that segment. For example:
154-
155-
| Address |
156-
|-------------------------|
157-
| router.**wod**.docker |
158-
| pg-admin.**wod**.docker |
159-
| ui.**wod**.docker |
160-
| etc. |
161-
162-
<br>
163-
164-
### → SSL certificates
165-
166-
Don't forget to include first level domains into the `TLS_DOMAINS` variable. Default certificates will be created for these domains and wildcards:
167-
168-
| SSL certificate | Comments |
169-
|------------------|-------------------------------------------------------------------------------------------------------------|
170-
| ui.docker | Included as fallback, if `SHARED_DOMAIN_SEGMENT` was left blank. |
171-
| router.docker | Included as fallback, if `SHARED_DOMAIN_SEGMENT` was left blank. |
172-
| pg-admin.docker | Included as fallback, if `SHARED_DOMAIN_SEGMENT` was left blank. |
173-
| *.wod.docker | All subdomains under this wildcard. **Only one level of nesting **will work in most of the browsers****. |
174-
| *.tpl.wod.docker | For default template, generated from [laravel-starter-tpl](https://github.com/wayofdev/laravel-starter-tpl) |
175-
176-
<br>
134+
7. **Run this project:**
177135

178-
### → Finishing
179-
180-
1. Install root certificate into system and generate default certs:
181-
182-
```bash
183-
make cert-install
184-
```
185-
186-
2. (Optional) Enable docker-compose.override file to run extra services, like pg-admin and others:
187-
188-
```bash
189-
make override
190-
```
191-
192-
3. Run this repository:
136+
Start the Docker services defined in the repository.
193137

194138
```bash
195139
make up
196140
```
197141

198-
4. Check that everything works:
142+
8. **Check that all Docker services are running:**
199143

200144
```bash
201145
make ps
202146
make logs
203147
```
204148

205-
<br>
206-
207-
### → Outcome
149+
9. **Ping `router.docker` to check if DNS is working:**
208150

209-
Services will be running under shared docker network, called `ss_shared_network` and all microservices, that will share same network, will be visible for Traefik, and local DNS, served by dnsmasq, will be available.
151+
Ensure that the DNS setup is functioning correctly.
210152

211-
**Traefik dashboard**[https://router.wod.docker](https://router.wod.docker/dashboard/#/)
153+
```bash
154+
ping router.docker
155+
```
212156

213-
![Traefik dashboard](.github/assets/traefik.png?raw=true "Traefik dashboard example")
157+
10. **Access Traefik dashboard:**
214158

215-
**Portrainer**<https://ui.wod.docker> or <https://ui.docker>
159+
Open [https://router.docker](https://router.docker)
216160

217-
**Pg-admin** (if `docker-compose.override.yaml` was enabled) — <https://pg-admin.wod.docker> or <https://pg-admin.docker>
161+
At this point, you should have a working local development environment with DNS and SSL support for your projects.
218162

219163
<br>
220164

221-
## 🧪 Testing
222-
223-
You can check `Makefile` to get full list of commands for local testing. For testing, you can use these commands to test whole role or separate tasks:
224-
225-
Testing docker-compose using `dcgoss`:
165+
## ⚡️ Connecting your Projects to Shared Services
166+
167+
To connect your projects to the shared services, configure your project's `docker-compose.yaml` file to connect to the shared network and Traefik.
168+
169+
For a quick example, you can check this [Laravel Starter Template](https://github.com/wayofdev/laravel-starter-tpl) repository's [docker-compose.yaml](https://github.com/wayofdev/laravel-starter-tpl/blob/develop/docker-compose.yaml) file, which includes a sample configuration for a Laravel project.
170+
171+
### → Sample Configuration
172+
173+
Your project should use the shared Docker network `network.ss` and Traefik labels to expose services to the outside world.
174+
175+
```diff
176+
---
177+
178+
services:
179+
web:
180+
image: wayofdev/nginx:k8s-alpine-latest
181+
container_name: ${COMPOSE_PROJECT_NAME}-web
182+
restart: on-failure
183+
+ networks:
184+
+ - default
185+
+ - shared
186+
depends_on:
187+
- app
188+
links:
189+
- app
190+
volumes:
191+
- ./app:/app:rw,cached
192+
- ./.env:/app/.env
193+
+ labels:
194+
+ - traefik.enable=true
195+
+ - traefik.http.routers.api-${COMPOSE_PROJECT_NAME}-secure.rule=Host(`api.${COMPOSE_PROJECT_NAME}.docker`)
196+
+ - traefik.http.routers.api-${COMPOSE_PROJECT_NAME}-secure.entrypoints=websecure
197+
+ - traefik.http.routers.api-${COMPOSE_PROJECT_NAME}-secure.tls=true
198+
+ - traefik.http.services.api-${COMPOSE_PROJECT_NAME}-secure.loadbalancer.server.port=8880
199+
+ - traefik.docker.network=network.ss
200+
201+
networks:
202+
+ shared:
203+
+ external: true
204+
+ name: network.ss
205+
+ default:
206+
+ name: project.laravel-starter-tpl
226207

227-
```bash
228-
make test
229208
```
230209

231210
<br>

0 commit comments

Comments
 (0)