Skip to content

Commit

Permalink
chore: DRYer port configs
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinmichaelchen committed Jan 7, 2024
1 parent cdb6515 commit 797b82d
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 26 deletions.
6 changes: 6 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
PORT_API_ORG=9090
PORT_API_PROFILE=9091
PORT_API_LICENSE=9092
PORT_DB_ORG=15432
PORT_DB_PROFILE=15433
PORT_DB_LICENSE=15434
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ check_pkgx:
.PHONY: all
all: check_pkgx stop
pkgx temporal@latest server start-dev &
sleep 2
pkgx eb -x 20 -- lsof -i :7233
pkgx task@latest run:all

.PHONY: stop
Expand Down
2 changes: 2 additions & 0 deletions Taskfile.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
version: "3"

dotenv: ['.env']

includes:
buf:
taskfile: ./taskfiles/buf.yml
Expand Down
6 changes: 3 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ services:
POSTGRES_PASSWORD: postgrespassword
restart: always
ports:
- "127.0.0.1:15432:5432"
- "127.0.0.1:${PORT_DB_ORG}:5432"
volumes:
- pg_data_org:/var/lib/postgresql/data
healthcheck:
Expand All @@ -18,13 +18,13 @@ services:
db-profile:
<<: *db_org
ports:
- "127.0.0.1:15433:5432"
- "127.0.0.1:${PORT_DB_PROFILE}:5432"
volumes:
- pg_data_profile:/var/lib/postgresql/data
db-license:
<<: *db_org
ports:
- "127.0.0.1:15434:5432"
- "127.0.0.1:${PORT_DB_LICENSE}:5432"
volumes:
- pg_data_license:/var/lib/postgresql/data

Expand Down
33 changes: 17 additions & 16 deletions docs/upstreams.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,38 +5,39 @@ worker.

Some quick curl commands to communicate with each of the 3 microservices.

### License Service
### Org Service

```shell
curl -v http://localhost:9090/license.v1beta1.LicenseService/CreateLicense \
curl -v http://localhost:9090/org.v1beta1.OrgService/CreateOrg \
-H "Content-Type: application/json" \
-d '{"name": "L1"}'
-d '{"name": "Org1"}'

http POST \
http://localhost:9090/license.v1beta1.LicenseService/CreateLicense \
name="L1"
http://localhost:9090/org.v1beta1.OrgService/CreateOrg \
name="Org1"
```

### Org Service
### Profile Service

```shell
curl -v http://localhost:9091/org.v1beta1.OrgService/CreateOrg \
curl -v http://localhost:9091/profile.v1beta1.ProfileService/CreateProfile \
-H "Content-Type: application/json" \
-d '{"name": "Org1"}'
-d '{"full_name": "Kevin Chen"}'

http POST \
http://localhost:9091/org.v1beta1.OrgService/CreateOrg \
name="Org1"
http://localhost:9091/profile.v1beta1.ProfileService/CreateProfile \
full_name="Kevin Chen"
```

### Profile Service
### License Service

```shell
curl -v http://localhost:9092/profile.v1beta1.ProfileService/CreateProfile \
curl -v http://localhost:9092/license.v1beta1.LicenseService/CreateLicense \
-H "Content-Type: application/json" \
-d '{"name": "Kevin Chen"}'
-d '{"start": "2023-11-16T12:00:00Z", "end": "2024-01-16T12:00:00Z"}'

http POST \
http://localhost:9092/profile.v1beta1.ProfileService/CreateProfile \
name="Kevin Chen"
```
http://localhost:9092/license.v1beta1.LicenseService/CreateLicense \
start="2023-11-16T12:00:00Z" \
end="2024-01-16T12:00:00Z"
```
6 changes: 0 additions & 6 deletions taskfiles/run.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
version: '3'

vars:
PORT_API_ORG: 9091
PORT_API_LICENSE: 9090
PORT_API_PROFILE: 9092
PORT_DB_ORG: 15432
PORT_DB_PROFILE: 15433
PORT_DB_LICENSE: 15434
SCHEMA_ORG: org.hcl
SCHEMA_PROFILE: profile.hcl
SCHEMA_LICENSE: license.hcl
Expand Down

0 comments on commit 797b82d

Please sign in to comment.