-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add docker-compose to run Khan locally #61
Changes from 4 commits
54d7297
3c0406d
64d2840
2d7830f
554191f
a05b19b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
language: go | ||
|
||
go: | ||
- 1.11 | ||
- 1.12 | ||
|
||
sudo: false | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
version: "3.8" | ||
|
||
services: | ||
khan: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
depends_on: | ||
postgres: | ||
condition: service_healthy | ||
redis: | ||
condition: service_healthy | ||
elasticsearch: | ||
condition: service_healthy | ||
links: | ||
- postgres | ||
- redis | ||
- elasticsearch | ||
ports: | ||
- "80:80" | ||
networks: | ||
- khan | ||
environment: | ||
- KHAN_POSTGRES_HOST=postgres | ||
- KHAN_POSTGRES_USER=postgres | ||
- KHAN_POSTGRES_PASSWORD=123456 | ||
- KHAN_ELASTICSEARCH_HOST=elasticsearch | ||
|
||
migrate: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
command: "make migrate" | ||
depends_on: | ||
postgres: | ||
condition: service_healthy | ||
links: | ||
- postgres | ||
networks: | ||
- khan | ||
environment: | ||
- KHAN_POSTGRES_HOST=postgres | ||
- KHAN_POSTGRES_USER=postgres | ||
- KHAN_POSTGRES_PASSWORD=123456 | ||
|
||
postgres: | ||
image: postgres:9.6 | ||
restart: always | ||
environment: | ||
- POSTGRES_PASSWORD=123456 | ||
- POSTGRES_USER=postgres | ||
- POSTGRES_DB=khan | ||
ports: | ||
- "5432:5432" | ||
volumes: | ||
- ./docker-data/postgres:/var/lib/postgresql/data | ||
networks: | ||
- khan | ||
healthcheck: | ||
test: ["CMD-SHELL", "pg_isready -U postgres"] | ||
interval: 5s | ||
timeout: 5s | ||
retries: 5 | ||
|
||
redis: | ||
image: redis | ||
restart: always | ||
ports: | ||
- "6379:6379" | ||
networks: | ||
- khan | ||
healthcheck: | ||
test: ["CMD", "redis-cli", "ping"] | ||
interval: 1s | ||
timeout: 3s | ||
retries: 30 | ||
|
||
elasticsearch: | ||
image: elasticsearch:5.6.12 | ||
ports: | ||
- '9200:9200' | ||
- '9300:9300' | ||
networks: | ||
- khan | ||
volumes: | ||
- ./docker-data/elasticsearch:/usr/share/elasticsearch/data | ||
environment: | ||
- xpack.security.enabled=false | ||
- discovery.type=single-node | ||
healthcheck: | ||
test: ["CMD-SHELL", "curl --silent --fail localhost:9200/_cluster/health || exit 1"] | ||
interval: 30s | ||
timeout: 30s | ||
retries: 3 | ||
|
||
networks: | ||
khan: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A suggestion: we could use the same network name for all services, to help us to integrate with other services (this is why I named the network as There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Great. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,4 @@ | |
package util | ||
|
||
// VERSION identifies Khan's current version | ||
var VERSION = "4.3.12" | ||
var VERSION = "4.3.13" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using this configuration with a
docker-compose up
without reading README,migrate
andkhan
will be running concurrently. Could we have problems with thekhan
container due to this?Which is the advantage of running
migrate
outside thekhan
container?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. I can override the command to execute both make commands instead of using two separated services.