aws / amazon-ecs-init

ecs-init is now part of the amazon-ecs-agent repo https://github.com/aws/amazon-ecs-agent/tree/master/ecs-init
https://github.com/aws/amazon-ecs-agent
Apache License 2.0
200 stars 118 forks source link

Proxy settings are lost on yum update #82

Closed alvarow closed 7 years ago

alvarow commented 7 years ago

Hello... upon performing a yum update, the init script at /etc/init/ecs.conf is replaced, and the proxy settings there are lost and even though ECS itself is properly configured at /etc/ecs/ecs.config, the agent itself gets misconfigured.

Here's what my init looks like:

[root@ip-10-204-232-117 ~]# cat /etc/init/ecs.conf
# Copyright 2014-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the
# "License"). You may not use this file except in compliance
# with the License. A copy of the License is located at
#
#     http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompanying this file. This file is
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
# CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and
# limitations under the License.

description "Amazon EC2 Container Service init"
author "Amazon Web Services"
start on stopped rc RUNLEVEL=[345]

pre-start exec /usr/libexec/amazon-ecs-init pre-start
env http_proxy="http://internal-DIT-FIT-Proxy-1762651060.us-east-1.elb.amazonaws.com:3128"
env https_proxy="http://internal-DIT-FIT-Proxy-1762651060.us-east-1.elb.amazonaws.com:3128"
env no_proxy="169.254.169.254,/var/run/docker.sock,127.0.0.1,localhost,10.204.232.0/24"
exec /usr/libexec/amazon-ecs-init start
pre-stop exec /usr/libexec/amazon-ecs-init pre-stop
post-stop exec /usr/libexec/amazon-ecs-init post-stop
samuelkarp commented 7 years ago

Are you trying to configure the ECS agent or ecs-init? Configuration for the ECS agent is stored at /etc/ecs/ecs.config and will not get replaced during a yum transaction.

If you're trying to set a proxy for ecs-init itself, you'll want to set those env lines in /etc/init/ecs.override instead.

alvarow commented 7 years ago

Ha! Thanks so much Samuel, I will update my cloud-init scripts to reflect that... I've been just rebuilding the instances, but seemed silly since there were no significant changes.

samuelkarp commented 7 years ago

You're welcome! Please let me know if you run into any problems with this.