Skip to content

Commit

Permalink
Deploy doctor in docker. Run doctor/start|stop from the engines root.
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelff committed Jun 28, 2023
1 parent 8526679 commit 1b9c45c
Show file tree
Hide file tree
Showing 9 changed files with 54 additions and 23 deletions.
33 changes: 33 additions & 0 deletions docker-compose.doctor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
version: "3"
services:
db:
image: postgres:15
restart: always
command: postgres -c 'config_file=/etc/postgresql/postgresql.conf'
environment:
POSTGRES_PASSWORD: "prisma"
POSTGRES_HOST_AUTH_METHOD: "md5"
POSTGRES_INITDB_ARGS: "--auth-host=md5"
volumes:
- "./docker/doctor/db/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d"
- "./docker/doctor/db/conf/postgresql.conf:/etc/postgresql/postgresql.conf"
ports:
- "5432:5432"
networks:
- doctor

doctor:
build:
context: .
dockerfile: ./docker/doctor/doctor/Dockerfile
args:
- db_url=postgres://postgres:prisma@db:5432
ports:
- "8080:8080"
networks:
- doctor
depends_on:
- db

networks:
doctor: null
18 changes: 1 addition & 17 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,22 +110,6 @@ services:
networks:
- databases

postgres-doctor:
image: postgres:15
restart: always
command: postgres -c 'config_file=/etc/postgresql/postgresql.conf'
environment:
POSTGRES_PASSWORD: "prisma"
POSTGRES_HOST_AUTH_METHOD: "md5"
POSTGRES_INITDB_ARGS: "--auth-host=md5"
volumes:
- "./docker/postgres-doctor/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d"
- "./docker/postgres-doctor/conf/postgresql.conf:/etc/postgresql/postgresql.conf"
ports:
- "5432:5432"
networks:
- databases

postgres15:
image: postgres:15
restart: always
Expand Down Expand Up @@ -260,7 +244,7 @@ services:
- "1434:1433"
networks:
- databases

mssql-2019:
image: mcr.microsoft.com/mssql/server:2019-latest
restart: always
Expand Down
File renamed without changes.
12 changes: 12 additions & 0 deletions docker/doctor/doctor/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM rust:1.70.0
ARG db_url
WORKDIR /usr/src/doctor
COPY doctor/src ./src
COPY doctor/Cargo.toml ./Cargo.toml
RUN cargo install --path .

ENV DATABASE_URL=$db_url
ENV RUST_LOG=debug
ENV PORT 8080
EXPOSE 8080
CMD ["doctor"]
5 changes: 0 additions & 5 deletions doctor/run_server.sh

This file was deleted.

2 changes: 1 addition & 1 deletion doctor/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ async fn main() -> std::io::Result<()> {
.service(clear_stats)
.wrap(Logger::default())
})
.bind(("127.0.0.1", port))?
.bind(("0.0.0.0", port))?
.run()
.await;

Expand Down
4 changes: 4 additions & 0 deletions doctor/start
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
cd $(dirname $0)
docker compose -f ../docker-compose.doctor.yml up -d
open http://localhost:8080/slow-queries
3 changes: 3 additions & 0 deletions doctor/stop
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
cd $(dirname $0)
docker compose -f ../docker-compose.doctor.yml down

0 comments on commit 1b9c45c

Please sign in to comment.