Skip to content
This repository has been archived by the owner on Jun 24, 2022. It is now read-only.

Use systemd's RequiresMountsFor #528

Merged
merged 1 commit into from
Jan 24, 2019
Merged

Use systemd's RequiresMountsFor #528

merged 1 commit into from
Jan 24, 2019

Conversation

Fra-nk
Copy link

@Fra-nk Fra-nk commented Jan 15, 2019

User might be interested in separating ephemeral and persistent data.
Among others, this can be done by putting data_dir on another disk.

When doing that in cloud environments via cloud-init or waagent you need to time the service start to after the necessary devices are mounted, otherwise a low run-level can result in trying to start the service before all data/mounts is/are available.

This PR adds systemd's RequiresMountsFor directive for the corresponding folders.

@elasticmachine
Copy link
Collaborator

Since this is a community submitted pull request, a Jenkins build has not been kicked off automatically. Can an Elastic organization member please verify the contents of this patch and then kick off a build manually?

@Crazybus
Copy link
Contributor

jenkins test this please

Copy link
Contributor

@Crazybus Crazybus left a comment

Choose a reason for hiding this comment

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

LGTM apart from the extra comment that seems to have slipped in.

This is a really cool feature that I hadn't seen used before. Thanks for adding it in!

@@ -3,6 +3,8 @@ Description=Elasticsearch-{{es_instance_name}}
Documentation=http://www.elastic.co
Wants=network-online.target
After=network-online.target
{# Directive 'WorkingDirectory' creates an implicit dependecy and can be omitted #}
Copy link
Contributor

Choose a reason for hiding this comment

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

Did you mean to leave this in? This comment mentions the WorkingDirectory directive but you are adding in RequiresMountsFor.

Copy link
Author

@Fra-nk Fra-nk Jan 17, 2019

Choose a reason for hiding this comment

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

The WorkingDirectory directive is used in line 18.
It implicitly creates the necessary After=/Requires= directives for {{es_home}}, therefore we can skip adding {{es_home}} to the list of folders in RequiresMountsFor.

I'll refine the comment to make it more clear, why I skipped {{es_home}}.

Do you prefer Jinja2 comments here, i.e. comments that are no longer in the templated file, or "regular" comments?

Copy link
Author

Choose a reason for hiding this comment

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

Updated the Jinja comment for now - since we're using template variables, it would imho be confusing in the final systemd-unitfile.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you for clarifying and updating it!

User might be interested in separating data
in ephemeral and persistent state, especially
in cloud environments, e.g. data_dir on
another disk.
@Fra-nk
Copy link
Author

Fra-nk commented Jan 22, 2019

I would consider the changes as resolved, until further notice.

Waiting for feedback :)

@Crazybus
Copy link
Contributor

jenkins test this please

@Crazybus Crazybus merged commit e4ce1b2 into elastic:master Jan 24, 2019
@Crazybus
Copy link
Contributor

Thank you @Fra-nk for adding this in!

(And for teaching me about a cool systemd feature)

@Fra-nk Fra-nk deleted the Systemd_Mount_Requirements branch January 24, 2019 11:50
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants