Skip to content

Instantly share code, notes, and snippets.

@kartsims
Created December 13, 2018 19:31
Show Gist options
  • Save kartsims/3514ed2cdab4abd9b28c46ae9c41ae22 to your computer and use it in GitHub Desktop.
Save kartsims/3514ed2cdab4abd9b28c46ae9c41ae22 to your computer and use it in GitHub Desktop.
Reproduce ewallet error
version: "3"
services:
postgres:
image: postgres:9.6.9-alpine
restart: always
volumes:
- postgres-db:/var/lib/postgresql/data
networks:
- internal
environment:
POSTGRESQL_PASSWORD: passw0rd
healthcheck:
test: ["CMD-SHELL", "pg_isready", "-U", "postgres"]
interval: 30s
retries: 3
mailhog:
image: mailhog/mailhog:v1.0.0
restart: always
networks:
- internal
ewallet:
image: omisego/ewallet:latest
restart: always
networks:
- internal
- external
depends_on:
- postgres
environment:
DATABASE_URL: "postgresql://postgres:passw0rd@postgres:5432/ewallet"
LOCAL_LEDGER_DATABASE_URL: "postgresql://postgres:passw0rd@postgres:5432/local_ledger"
EWALLET_SECRET_KEY: "/dS+yXUIiRS/D8WLflgTVwyR6Rr87vV/4cgaloSDVg8="
LOCAL_LEDGER_SECRET_KEY: "daE0oTHOdG/NL8qmE8Ejv0lkHVaqs5J6UEKtoXEwh0E="
SMTP_HOST: mailhog
SMTP_PORT: 1025
ports:
- 4000:4000
networks:
external:
internal:
volumes:
postgres-db:
@unnawut
Copy link

unnawut commented Dec 17, 2018

Looks like the endless restart is a valid issue.

Starting the ewallet never makes a query to the database, but now that we have the customizable settings stored in the database, the ewallet makes DB queries right after it starts up. When a DB query fails, a restart is followed.

Because of that, the docker exec ... command to create + migrate + seed` the database doesn’t reliably work due to the repeated restart. And this is more likely to happen on freshly created instances than existing ones because the migration + seed takes some time, most likely longer than the container’s lifetime before each restart.

@samundra
Copy link

Have you guys found any solution for this? Is there anyway that we can manually create+migrate+seed the DB?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment