Skip to content

Commit 3680ba9

Browse files
committed
Moving credentials to .env file
1 parent a79ec81 commit 3680ba9

File tree

5 files changed

+23
-23
lines changed

5 files changed

+23
-23
lines changed

.flaskenv

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
FLASK_APP=mltrace/server/__init__.py
2-
FLASK_ENV=production
2+
FLASK_ENV=production
3+
DB_URI=postgresql://admin:admin@database:5432/sqlalchemy

.postgresenv

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
POSTGRES_USER=admin
2+
POSTGRES_PASSWORD=admin
3+
POSTGRES_DB=sqlalchemy

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ If you are interested in learning about specific `mltrace` concepts, please read
2929

3030
### Database setup (server-side)
3131

32-
We use Postgres-backed SQLAlchemy. Assuming you have Docker installed, you can run the following commands from the
32+
First, you will need to create DB credentials. We use Postgres. There is a `.postgresenv` file in the root directory, but you should set your own values for the params.
33+
34+
Assuming you have Docker installed, you can run the following commands from the
3335
root directory after cloning the most recent release:
3436

3537
```
@@ -72,6 +74,8 @@ You can also look at `examples` for ways to integrate `mltrace` into your ML pip
7274

7375
### Launch UI (client-side)
7476

77+
Double check the Postgres credentials in `.flaskenv` match the credentials set in `.postgresenv`.
78+
7579
If you ran `docker-compose up` from the root directory, you can just navigate to the server's IP address at port 8080 (or `localhost:8080`) in your browser. To launch a dev version of the UI, navigate to `./mltrace/server/ui` and execute `yarn install` then `yarn start`. It should be served at [localhost:3000](localhost:3000). The UI is based on `create-react-app` and [`blueprintjs`](https://blueprintjs.com/docs/). Here's an example of what tracing an output would give:
7680

7781
![screenshot](./res/trace.png)

docker-compose-not-ui.yml

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,10 @@ services:
33

44
database:
55
image: postgres
6-
volumes:
7-
- postgres_data:/var/lib/postgresql/data
8-
environment:
9-
POSTGRES_USER: admin
10-
POSTGRES_PASSWORD: admin
11-
POSTGRES_DB: sqlalchemy
6+
volumes:
7+
- postgres_data:/var/lib/postgresql/data
8+
env_file:
9+
- ./.postgresenv
1210
ports:
1311
- "5432:5432"
1412
restart: always
@@ -21,11 +19,8 @@ services:
2119
build:
2220
context: .
2321
dockerfile: ./mltrace/server/Dockerfile
24-
# dockerfile: ./mltrace/server/Dockerfile
25-
# dockerfile: ./mltrace/server/Dockerfile
2622
environment:
2723
PYTHONPATH: /src
28-
DB_URI: "postgresql://admin:admin@database:5432/sqlalchemy"
2924
volumes:
3025
- .:/src
3126
ports:
@@ -40,10 +35,10 @@ services:
4035
aliases:
4136
- api
4237

43-
volumes:
38+
volumes:
4439
postgres_data:
4540

4641
networks:
4742
services-network:
4843
name: services-network
49-
driver: bridge
44+
driver: bridge

docker-compose.yml

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,10 @@ services:
1616

1717
database:
1818
image: postgres
19-
volumes:
20-
- postgres_data:/var/lib/postgresql/data
21-
environment:
22-
POSTGRES_USER: admin
23-
POSTGRES_PASSWORD: admin
24-
POSTGRES_DB: sqlalchemy
19+
volumes:
20+
- postgres_data:/var/lib/postgresql/data
21+
env_file:
22+
- ./.postgresenv
2523
ports:
2624
- "5432:5432"
2725
restart: always
@@ -36,7 +34,6 @@ services:
3634
dockerfile: ./mltrace/server/Dockerfile
3735
environment:
3836
PYTHONPATH: /src
39-
DB_URI: "postgresql://admin:admin@database:5432/sqlalchemy"
4037
volumes:
4138
- .:/src
4239
ports:
@@ -50,11 +47,11 @@ services:
5047
services-network:
5148
aliases:
5249
- api
53-
54-
volumes:
50+
51+
volumes:
5552
postgres_data:
5653

5754
networks:
5855
services-network:
5956
name: services-network
60-
driver: bridge
57+
driver: bridge

0 commit comments

Comments
 (0)