Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions bin/codedeploy-launchd
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

# Run the CodeDeploy agent in the foreground so that it
# can be controlled by MacOS's launchd. This does away with
# most of the Gli command-line handling stuff, since this has
# only one way of being invoked (i.e. launchd).
#
# Mostly copied from the official CLI entrypoint in `lib/codedeploy-agent.rb`
agent_dir = '/opt/aws/codedeploy'
$LOAD_PATH.unshift "#{agent_dir}/lib"

require 'instance_agent'

# Always use the config file from the installation root:
InstanceAgent::Config.config(
config_file: "#{agent_dir}/conf/codedeployagent.yml"
)

InstanceAgent::Platform.util = InstanceAgent::LinuxUtil
InstanceAgent::Config.load_config

# The `.new` here ensures that the master runs in the foreground instead of as
# a daemon.
InstanceAgent::Runner::Master.new.start
18 changes: 18 additions & 0 deletions init.d/com.amazon.aws.codedeploy.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.amazon.aws.codedeploy</string>
<key>UserName</key>
<string>root</string>
<key>RunAtLoad</key>
<true/>
<key>ProgramArguments</key>
<array>
<string>/opt/aws/codedeploy/bin/codedeploy-launchd</string>
</array>
<key>KeepAlive</key>
<true/>
</dict>
</plist>