Skip to content

Commit 55b3415

Browse files
authored
Updating Hanami setup to be more inline with my rails setup (#6)
1 parent fe532ee commit 55b3415

File tree

2 files changed

+17
-27
lines changed

2 files changed

+17
-27
lines changed

App-Template/.env.sample

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
# Configuration for Hanami environment
2-
# REDIS_URL=
3-
# DATABASE_URL=
1+
# If you want, you can run:
2+
# $ docker compose up redis postgres
3+
# $ bundle exec rails s
4+
# I know for some people it's a little more performant :)
5+
REDIS_URL= redis://@127.0.0.1:6379/1
6+
DATABASE_URL= postgres://postgres:[email protected]:5432/
47

58
# Adhoc ENVs
69
LANG=en_US.UTF-8

App-Template/docker-compose.yml

Lines changed: 11 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ x-app: &app
1010
context: .
1111
dockerfile: Dockerfile
1212
target: development
13-
env_file:
14-
- .env
13+
tmpfs:
14+
- /tmp
1515
environment:
1616
REDIS_URL: redis://@redis:6379/1
1717
DATABASE_URL: postgres://postgres:postgres@postgres:5432/
@@ -30,52 +30,39 @@ services:
3030
image: postgres:12.3-alpine
3131
mem_limit: 64m
3232
volumes:
33+
- ./log:/root/log:cached
3334
- postgresql:/var/lib/postgresql/data:delegated
34-
# Alternative if you want to store your postgres data outside of a volume
35-
#- ~/.docker-data/hanami-app/postgresql:/var/lib/postgresql/data:delegated
36-
# ports:
37-
# - 5432
35+
ports:
36+
- "127.0.0.1:5432:5432"
3837
environment:
38+
PSQL_HISTFILE: /root/log/.psql_history
3939
POSTGRES_USER: postgres
4040
POSTGRES_PASSWORD: postgres
4141
restart: on-failure
4242
healthcheck:
4343
test: ["CMD-SHELL", "pg_isready -U postgres"]
4444
interval: 10s
45-
timeout: 5s
46-
retries: 5
45+
timeout: 2s
46+
retries: 10
4747
logging:
4848
driver: none
4949

5050
redis:
5151
image: redis:4.0.14-alpine
5252
mem_limit: 64m
53-
command: >
54-
--save
55-
--maxmemory 128mb
56-
--maxmemory-policy noeviction
57-
--stop-writes-on-bgsave-error yes
58-
--rdbcompression yes
59-
--rdbchecksum yes
60-
--dir /data
6153
volumes:
6254
- redis:/data:delegated
63-
# ports:
64-
# - 6379
55+
ports:
56+
- "127.0.0.1:6379:6379"
6557
restart: on-failure
66-
healthcheck:
67-
test: ["CMD", "redis-cli", "ping"]
68-
interval: 10s
69-
timeout: 5s
70-
retries: 5
7158
logging:
7259
driver: none
7360

7461
web:
7562
<<: *app
7663
command: bash -c "rm -rf /usr/src/app/tmp/pids/server.pid && bundle exec hanami server --port=3000 --host=0.0.0.0"
7764
ports:
78-
- "${PORT:-3000}:3000"
65+
- "127.0.0.1:${PORT:-3000}:3000"
7966

8067
volumes:
8168
postgresql:

0 commit comments

Comments
 (0)