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

Use the recommended systemd config #129

Merged
merged 3 commits into from Apr 6, 2018
Merged

Conversation

lagartoflojo
Copy link
Contributor

Puma specifies a recommended way of starting it with systemd at:
https://github.com/puma/puma/blob/5fb2df9144803f0f80ec1d9fb19d20d433706fef/docs/systemd.md#service-configuration

Type=simple can be used, and then there's not need to --daemon the Rails
server.
Additionally, we set the RAILS_LOG_TO_STDOUT variable, so that Rails
outputs its log to stdout. This allows for the logs to be saved and
visible in journalctl.

The PrivateTmp option "sets up a new file system namespace for the
executed processes and mounts private /tmp and /var/tmp directories
inside it that is not shared by processes outside of the namespace.
(...) all temporary files created by a service in these directories will
be removed after the service is stopped."

Since RMT creates some temporary directories while mirroring, with this
option we isolate them and make sure they get deleted when RMT is
stopped.

Copy link
Contributor

@ikapelyukhin ikapelyukhin left a comment

Choose a reason for hiding this comment

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

LGTM, other than removing the log directory.

User=_rmt
PrivateTmp=yes
Environment=RAILS_LOG_TO_STDOUT=1
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks good, but I'd suggest making changes to the RPM package as well -- currently it creates an empty log directory to store file logs. It can be dropped now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Does 923488d look good?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yep! 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Cool. I can't merge until we merge the parser gem fix xD

Puma specifies a recommended way of starting it with systemd at:
https://github.com/puma/puma/blob/5fb2df9144803f0f80ec1d9fb19d20d433706fef/docs/systemd.md#service-configuration

Type=simple can be used, and then there's not need to --daemon the Rails
server.
Additionally, we set the RAILS_LOG_TO_STDOUT variable, so that Rails
outputs its log to stdout. This allows for the logs to be saved and
visible in journalctl.

The PrivateTmp option "sets up a new file system namespace for the
executed processes and mounts private /tmp and /var/tmp directories
inside it that is not shared by processes outside of the namespace.
(...) all temporary files created by a service in these directories will
be removed after the service is stopped."

Since RMT creates some temporary directories while mirroring, with this
option we isolate them and make sure they get deleted when RMT is
stopped.

Closes #128.
Since the logs are stored by journalctl, that directory is no longer
necessary.
@lagartoflojo lagartoflojo merged commit 10fdba7 into master Apr 6, 2018
@lagartoflojo lagartoflojo deleted the proper-systemd-service branch April 6, 2018 10:14
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

2 participants