Skip to content
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

Merged
merged 2 commits into from Apr 7, 2021
Merged

Smayorov back helloworld #7

merged 2 commits into from Apr 7, 2021

Conversation

samnix-p
Copy link
Collaborator

@samnix-p samnix-p commented Apr 2, 2021

  • Добавлен пример hello world с nab
  • Добавлен docker-compose на весь проект (front + back)

volumes:
- ./back/migrations/:/docker-entrypoint-initdb.d/
ports:
- "5432:5432"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Если линкуешь делаешь связь контейнеров через link, то выставлять порты не обязательно
Это касается и бекенда

Copy link
Collaborator

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:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Вопрос - depends_on бекенда будет дожидаться когда сработает healthcheck в бд?

Copy link
Collaborator

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 компоуз файл потому что я так и не увидел явно что его будут продолжать саппортить.

Copy link
Collaborator

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

@SuhoyVasya
Copy link
Collaborator

кстати еще - у наб приложения по умолчанию есть healthcheck ресурс \status
можешь добавить на твое усмотрение

version: '3'

services:
postgres:
Copy link
Owner

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

Copy link
Collaborator

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
Я бы хотел запускать бэк отдельно потому что это быстрее, но это вроде можно сделать и без отдельного компоуз файла (передать конкретные сервисы для запуска). Так что я за удаление.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Готово

@nikitakalyanov
Copy link
Collaborator

Добавил healthcheck для бэка

@varchugov varchugov merged commit a67603f into master Apr 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants