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

Add restart support for docker-compose #157

Closed

Conversation

waveywaves
Copy link
Member

@waveywaves waveywaves commented Jun 12, 2022

Convert docker-compose restart options to Kubernetes restartPolicy
docker-compose docs:
https://docs.docker.com/compose/compose-file/#restart

kubernetes docs:
https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#restart-policy

fixes #140

@waveywaves waveywaves force-pushed the feature/support-restart branch 5 times, most recently from dcd42ad to 8056eac Compare June 13, 2022 06:54
@waveywaves waveywaves force-pushed the feature/support-restart branch from 8056eac to 637c323 Compare June 13, 2022 07:00
@gadkins gadkins requested a review from moklidia June 13, 2022 14:59
@gadkins
Copy link
Member

gadkins commented Jun 13, 2022

Tagging @moklidia for review of this PR

@moklidia moklidia changed the base branch from main to develop June 15, 2022 08:04
when 'no', 'always', 'on-failure'
restart_policy
when 'unless-stopped'
raise UffizziCore::ComposeFile::ParseError, I18n.t('compose.invalid_restart_policy')
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's add a default case


hello-world:
image: nginx:latest
restart: always
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's add a test to check that the option is parsed correctly

@@ -152,6 +152,7 @@
t.string "command"
t.string "service_name"
t.jsonb "healthcheck"
t.jsonb "restart"
Copy link
Contributor

Choose a reason for hiding this comment

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

why restart is jsonb? It's looks like a string

class UffizziCore::ComposeFile::Parsers::Services::RestartParserService
class << self
def parse(restart_data)
return nil if restart_data.nil?
Copy link
Contributor

Choose a reason for hiding this comment

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

We can do return if restart_data.nil? without explicitly return nil


private

def parse_restart(restart_data)
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe it would be better to put this code in the method def parse? I mean, this code looks simple and maybe it doesn't make sense to split it into two methods

@gadkins gadkins deleted the branch UffizziCloud:develop June 21, 2022 06:31
@gadkins gadkins closed this Jun 21, 2022
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.

Support for the docker-compose restart option
7 participants