-
Notifications
You must be signed in to change notification settings - Fork 1
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
Smayorov back helloworld #7
Conversation
samnix-p
commented
Apr 2, 2021
- Добавлен пример hello world с nab
- Добавлен docker-compose на весь проект (front + back)
volumes: | ||
- ./back/migrations/:/docker-entrypoint-initdb.d/ | ||
ports: | ||
- "5432:5432" |
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.
Если линкуешь делаешь связь контейнеров через link, то выставлять порты не обязательно
Это касается и бекенда
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.
Да, но ports в такой форме еще пробрасывает порт на хост. Иногда может пригодится присоединится к постгресу в конейнере с хоста. Например хостовым клиентом psql посмотреть на таблички.
POSTGRES_PASSWORD: hh | ||
POSTGRES_DB: hh | ||
POSTGRES_USER: hh | ||
healthcheck: |
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.
Вопрос - depends_on бекенда будет дожидаться когда сработает healthcheck в бд?
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.
Нет, не будет т.к. в V3 выпилили кондишены в depends_on. Но здесь это разруливается restart: always (docker/compose#4305 (comment))
Не хочется переезжать на V2 компоуз файл потому что я так и не увидел явно что его будут продолжать саппортить.
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.
годится
FYI если будете собирать отдельный образ на java приложение - есть еще wait_for_it
https://github.com/vishnubob/wait-for-it
кстати еще - у наб приложения по умолчанию есть healthcheck ресурс \status |
version: '3' | ||
|
||
services: | ||
postgres: |
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.
можно сделать extends из back, и на pg и на back сервисы
или, если вам бэк отдельно от фронта будет ненужен, можно вобще тогда из back удалить compose
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.
Extends вроде тоже выпилили в V3(
https://docs.docker.com/compose/extends/#extending-services
Я бы хотел запускать бэк отдельно потому что это быстрее, но это вроде можно сделать и без отдельного компоуз файла (передать конкретные сервисы для запуска). Так что я за удаление.
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.
Готово
Добавил healthcheck для бэка |
5438773
to
64bbcb7
Compare