-
-
Notifications
You must be signed in to change notification settings - Fork 81
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 Dockerfile, docker-compose config #30
Conversation
Update fork
Update main from codeforboston/police-data-trust
POSTGRES_PASSWORD: postgres | ||
POSTGRES_DB: police_data | ||
volumes: | ||
- ./init-user-db.sh:/docker-entrypoint-initdb.d/init-user-db.sh |
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.
I'd use this as the volume - postgres:/var/lib/postgresql/data
with this at the end of the file:
volumes:
postgres: {}
and I'd also connect this service to the to the dotenv file with:
env_file:
- ".env"
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.
I've added both
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.
sorry it wasn't clear, also replace
volumes:
- ./init-user-db.sh:/docker-entrypoint-initdb.d/init-user-db.sh
with this:
volumes:
- postgres:/var/lib/postgresql/data
and then delete the init-user-db.sh
file.
This appears to be a more standard way to dockerize Postgres databases that helps to persist data across migrations and deployments.
One note about how the postgres service is defined, but otherwise LGTM |
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.
For the first time in world history I can open the site
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.
Worked for me too
6d92784
One more comment regarding the Postgres service. Once we've resolved that, I'll give a LGTM. |
@dwreeves According to the Postgres Docker image documentation, the init script and db volume can coexist: |
Your
.env
file should include (along with any other required vars):build and run with
docker-compose build; docker-compose up -d; docker-compose logs -f app