Skip to content

Commit 4d53eff

Browse files
authored
Merge pull request #2 from crane-cloud/ch-update-compose-file
chore: update docker-compose file and readme
2 parents 17c371f + dfead26 commit 4d53eff

File tree

2 files changed

+41
-4
lines changed

2 files changed

+41
-4
lines changed

README.md

+20-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,22 @@
11
# Database API
22

3-
To run the application:
4-
`uvicorn main:app --reload`
3+
The database API offers a convenient and efficient way to create MySQL and PostgreSQL databases for users on the Crane Cloud platform
4+
5+
# Project Setup
6+
7+
Follow these steps to have a local running copy of the app.
8+
9+
Clone The Repo
10+
```
11+
git clone https://github.com/crane-cloud/database-api.git
12+
```
13+
14+
# Running application with Docker
15+
16+
`make` is a build automation tool that is used to manage the build process of a software project.
17+
18+
In the project directory, running `make` shows you a list of commands to use.
19+
20+
Run `make start` to start the application and required services.
21+
22+
Run `make connect-to-container` to connect to the FastAPI application container.

docker-compose.yml

+21-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: "3"
1+
version: "3.8"
22
services:
33
database-api:
44
restart: always
@@ -9,8 +9,27 @@ services:
99
environment:
1010
PYTHONDONTWRITEBYTECODE: 1
1111
PYTHONUNBUFFERED: 1
12+
DATABASE_USER: postgres
13+
DATABASE_URI: ${DATABASE_URI:-postgresql://postgres:postgres@database:5432/cranecloud}
14+
TEST_DATABASE_URI: ${TEST_DATABASE_URI:-postgresql://postgres:postgres@database:5432/cranecloud_test}
1215
ports:
1316
- "${APP_PORT:-8000}:8000"
1417
volumes:
1518
- .:/app
16-
19+
depends_on:
20+
- database
21+
22+
database:
23+
restart: always
24+
image: postgres:10.8-alpine
25+
container_name: postgres-database
26+
environment:
27+
POSTGRES_USER: postgres
28+
POSTGRES_DB: cranecloud
29+
ports:
30+
- "4200:5432"
31+
volumes:
32+
- db-data:/var/lib/postgresql/data
33+
34+
volumes:
35+
db-data:

0 commit comments

Comments
 (0)