Skip to content

Commit

Permalink
docker compose updated, env and logs with time literally free with pr…
Browse files Browse the repository at this point in the history
…etty env logger xd (#352)
  • Loading branch information
pxp9 authored Sep 30, 2023
1 parent 0a0caae commit 170ade7
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 5 deletions.
15 changes: 13 additions & 2 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,22 @@ TELEGRAM_BOT_TOKEN= # insert @BotFather token here
DATABASE_POOL_SIZE=5 # must be 6 or less for free tier, 10+ for best performance
RUST_BACKTRACE=1
RUST_LOG=info
DATABASE_URL=postgres://postgres:postgres@localhost:5432/el_monitorro

### Use this connection url if you want to use docker compose
#DATABASE_URL="postgresql://postgres:postgres@db/el_monitorro"

### Use this other is you use a docker container in your local machine or PostgreSQL Db installed in your local machine
DATABASE_URL=postgres://postgres:postgres@127.0.0.1:5432/el_monitorro

BOT_BINARY=commands
SYNC_INTERVAL_SECONDS=120
SYNC_WORKERS_NUMBER=1
DELIVER_INTERVAL_SECONDS=60
DELIVER_WORKERS_NUMBER=1
CLEAN_INTERVAL_SECONDS=43200
ALL_BINARIES=true

################ DOCKER VARIABLES FOR MIGRATIONS ################
SETUP_DB=true
RUN_MIGRATION=true
BOT_BINARY=commands
ALL_BINARIES=true
33 changes: 31 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,35 @@
#### Create a volume 'x' and substitute the name 'x' of the volume created for 'your_volume'


#### PostgreSQL string connection should have 'db' as host because the link is called db
#### Example:
### DATABASE_URL="postgresql://postgres:postgres@db/el_monitorro"

services:
bot:
image: ayratbadykov/el_monitorro:dev
network_mode: host
image: ayratbadykov/el_monitorro:latest
depends_on:
- db
env_file: .env
restart: always
links:
- db:database
db:
image: postgres:13.4
container_name: postgres
healthcheck:
test: /usr/bin/pg_isready -d postgres://postgres:postgres@127.0.0.1/el_monitorro
interval: 5s
timeout: 10s
retries: 120
ports:
- 5432:5432
volumes:
- your_volume:/var/lib/postgresql/data #### Change the name 'your_volume' if needed
environment:
- POSTGRES_DB=el_monitorro
- POSTGRES_PASSWORD=postgres
- POSTGRES_USER=postgres
volumes:
your_volume: #### Change the name 'your_volume' if needed
external: true
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use fang::Queue;

fn main() {
dotenv().ok();
pretty_env_logger::init();
pretty_env_logger::init_timed();

let queue = Queue::builder()
.connection_pool(el_monitorro::db::pool().clone())
Expand Down

0 comments on commit 170ade7

Please sign in to comment.