Skip to content

Commit 30dfa61

Browse files
Feature/update document (#13)
* update .env.example; * update README.md;
1 parent 3759dd9 commit 30dfa61

File tree

2 files changed

+29
-6
lines changed

2 files changed

+29
-6
lines changed

README.md

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ Ensure you have the following installed:
100100

101101
- OpenFGA 1.8.9 (Optional) (Use your own local OpenFGA or you can use my docker-compose.dev.yaml)
102102

103+
- Consul 1.21 (Optional) (Use your own local Consul or you can use my docker-compose.dev.yaml)
104+
103105
- Docker & Docker Compose (Optional)
104106

105107
- make (Optional)
@@ -125,10 +127,12 @@ Ensure you have the following installed:
125127
# using Alembic (https://alembic.sqlalchemy.org/en/latest/)
126128

127129
# For manually generate migration files base on your need
128-
alembic revision -m <name_version>
130+
alembic -x sqlalchemy.url=postgresql+asyncpg://<username>:<password>@<ip>:<port>/<db> revision -m <name_version>
129131

130132
# For auto generate migrations files base on your models
131-
alembic revision --autogenerate -m <name_version>
133+
alembic -x sqlalchemy.url=postgresql+asyncpg://<username>:<password>@<ip>:<port>/<db> revision --autogenerate -m <name_version>
134+
135+
# Example: alembic -x sqlalchemy.url=postgresql+asyncpg://cleanarc:cleanarc!123@localhost:5432/cleanarc revision --autogenerate -m "update comments"
132136
```
133137

134138
4. **Manage Keycloak and Webhook Config**
@@ -162,13 +166,32 @@ Ensure you have the following installed:
162166
Step 4: Config token, store_id and authorization_model_id to our app.
163167
```
164168

165-
6. **Start the Application**
169+
6. **Setup Consul**
170+
171+
```sh
172+
This section is optional and our repo still working without Consul, just use local .env instead !!!
173+
174+
Follow the official document of Consul for details (https://developer.hashicorp.com/consul/docs).
175+
For basic setup, just follow some simple steps.
176+
177+
Step 1: Create a folder in "Key/Value" of Consul and set it to CFG_MANAGER_SERVICE__ENV
178+
Step 2: Create every env in .env.example inside the upper folder
179+
Step 3: Set CFG_MANAGER_SERVICE__ENABLE=true
180+
Step 4: Set CFG_MANAGER_SERVICE__URL and CFG_MANAGER_SERVICE__TOKEN
181+
Step 5: Start app
182+
183+
Note: Our internal/infrastructures/config_manager including the auto-reload configs function.
184+
```
185+
186+
7. **Start the Application**
166187

167188
```sh
168189
python main.py
190+
# or
191+
./run.sh
169192
```
170193

171-
7. **Alternative run with docker**
194+
8. **Alternative run with docker**
172195

173196
```sh
174197
# if you do not want to start from scratch, just run with docker
@@ -188,7 +211,7 @@ Ensure you have the following installed:
188211

189212
```
190213

191-
8. **Access the API**
214+
9. **Access the API**
192215

193216
- Use `http://127.0.0.1:8082/docs` for Swagger UI.
194217
- Use `http://127.0.0.1:8082/redoc` for Redoc documentation.

config/.env.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ CFG_MANAGER_SERVICE__URL=localhost:8500
1212

1313
# === Relational DB ===
1414
RELATIONAL_DB__VENDOR=postgres
15-
RELATIONAL_DB__URL=postgresql://user:password@localhost:5432/your_db
15+
RELATIONAL_DB__URL=postgresql+asyncpg://cleanarc:cleanarc!123@localhost:5432/cleanarc
1616
RELATIONAL_DB__ENABLE_LOG=true
1717
RELATIONAL_DB__ENABLE_AUTO_MIGRATE=true
1818

0 commit comments

Comments
 (0)