-
Notifications
You must be signed in to change notification settings - Fork 118
Conversation
ExecStopPost=/usr/libexec/amazon-ecs-init post-stop | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
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.
Please add a newline
fi | ||
|
||
%post | ||
# Symlink the bundled ECS Agent at loadable path. | ||
ln -sf ecs-agent-v%{bundled_agent_version}.tar %{cache_dir}/ecs-agent.tar |
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.
Looks like this got dropped in the amzn1 section...
License: Apache 2.0 | ||
Summary: Amazon Elastic Container Service initialization application | ||
BuildArch: x86_64 | ||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) | ||
ExclusiveArch: x86_64 |
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.
Why change from BuildArch to ExclusiveArch?
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.
@@ -31,6 +31,7 @@ const ( | |||
PRESTART = "pre-start" | |||
START = "start" | |||
PRESTOP = "pre-stop" | |||
STOP = "stop" |
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.
You don't appear to have updated the manpage to reflect this change.
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.
Indeed! I'll update and clarify how these targets should be used in the context of upstart and systemd.
touch $RPM_BUILD_ROOT/%{conf_dir}/ecs.config | ||
touch $RPM_BUILD_ROOT/%{conf_dir}/ecs.config.json | ||
install -D amazon-ecs-init %{buildroot}%{_libexecdir}/amazon-ecs-init | ||
install -D scripts/amazon-ecs-init.1 %{buildroot}%{_mandir}/man1/amazon-ecs-init.1 |
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.
We were explicitly compressing this before, but aren't here. Why?
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.
https://fedoraproject.org/wiki/Packaging:Guidelines#Manpages
When installing man pages, note that they should be installed uncompressed as the build system will compress them as needed.
Requires=docker.service | ||
After=docker.service | ||
|
||
[Service] |
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.
I wouldn't mind seeing Type=simple
set explicitly here. Otherwise people will need to understand the rules around the different defaults in order to understand this unit's behavior.
Name: ecs-init | ||
Version: 1.18.0 | ||
Release: 1%{?dist} | ||
Group: System Environment/Base | ||
Vendor: Amazon.com |
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.
Why do we no longer set Group or Vendor?
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.
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.
Why is that? Does that apply to all packages? It's not clear from that doc if there are fedora-specific reasons to avoid these tags or if they must not be present even in third-party packages.
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.
AL2 inherits the packaging guidelines from Fedora / EPEL, except for the ones we are explicitly incompatible with (such as ones requiring changes in RPM 4.14) or otherwise simply don't like (none of these are documented yet).
The Group field, I believe, is not listed in yum repodata (deprecated in favor of yum's groups in comps.xml). The Vendor field gets overwritten by our build system anyway.
@@ -0,0 +1,13 @@ | |||
[Unit] |
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.
Can you add the license header to this file?
See rendered man page here. Please leave comments in the PR and file. |
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.
LGTM
Trimmed down the commits. @samuelkarp PTAL at the man page updates specifically. |
The process executed by the ecs.service is going to remain running to supervise the ECS agent and handles lifecycle with the Exec* directives and also internally where required (eg: for agent upgrade functionality).
[Unit] | ||
Description=ECS Agent | ||
Requires=docker.service | ||
After=docker.service |
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.
We should probably have this run after cloud-init.target
so that you can configure the ECS agent using user-data.
This was inadvertently merged directly into the master and needs to be restaged. This reverts commit 52d5792.
Summary
This change wraps the existing
ecs-init
daemon (with minor semantic modifications) with a systemd unit to run under Amazon Linux 2.Implementation details
Minor modifications have been made to the entrypoints in the
ecs-init
binary to include thestop
verb to align with systemd semantics surrounding service lifecycle. Though there is no difference frompost-stop
from upstart land, this allows the two to coexist in code if a change in handling is required at a later time.The updated RPM spec accommodates both Amazon Linux and Amazon Linux 2 (thanks @ilianaw!) and includes a unit file suitable for running
ecs-init
on Amazon Linux 2 (withsystemctl start ecs
).Testing
The RPM was built both for Amazon Linux and Amazon Linux 2 and run in an ECS Cluster with some tasks to confirm no functional differences were present.
New tests cover the changes: no
Description for the changelog
Add Amazon Linux 2 systemd unit to RPM spec
Licensing
This contribution is under the terms of the Apache 2.0 License: yes