Replace custom upstart template with Frey's upstart

This commit is contained in:
Kevin van Zonneveld 2016-03-29 16:20:11 +02:00
parent 98a6cb0cc5
commit 7d6a7beb8b
2 changed files with 23 additions and 30 deletions

View File

@ -13,7 +13,7 @@
[infra.provider.aws]
access_key = "${var.FREY_AWS_ACCESS_KEY}"
region = "us-east-1"
region = "us-east-1"
secret_key = "${var.FREY_AWS_SECRET_KEY}"
[infra.variable.ami.default]
@ -126,6 +126,26 @@
hosts = "infra-tusd-server"
name = "Setup infra-tusd"
[[setup.playbooks.roles]]
role = "{{{init.paths.roles_dir}}}/upstart/v1.0.0"
upstart_command = "./tusd -port=8080 -dir=/mnt/tusd-data -store-size=10737418240"
upstart_description = "tusd server"
upstart_name = "{{{config.global.appname}}}"
upstart_pidfile_path = "{{{config.global.approot}}}/shared/{{{config.global.appname}}}.pid"
upstart_respawn = true
upstart_respawn_limit = true
upstart_runtime_root = "{{{config.global.approot}}}/current/tusd_linux_amd64/"
upstart_user = "www-data"
[[setup.playbooks.roles]]
role = "{{{init.paths.roles_dir}}}/rsyslog/v3.0.1"
[setup.playbooks.roles.rsyslog_rsyslog_d_files.49-tusd]
# Send {{{config.global.appname}}} messages to a dedicated logfile
directives = [ "&~" ]
[[setup.playbooks.roles.rsyslog_rsyslog_d_files.49-tusd.rules]]
rule = ":programname, startswith, \"{{{config.global.appname}}}\""
logpath = "{{{config.global.approot}}}/shared/logs/{{{config.global.appname}}}.log"
[[setup.playbooks.roles]]
role = "{{{init.paths.roles_dir}}}/fqdn/v1.0.0"
fqdn = "{{lookup('env', 'FREY_DOMAIN')}}"
@ -134,15 +154,13 @@
file = "path=/mnt/tusd-data state=directory owner=www-data group=www-data mode=0755 recurse=yes"
name = "infra-tusd | Create tusd data dir"
[[setup.playbooks.tasks]]
action = "template src=templates/upstart-tusd.conf.j2 dest=/etc/init/tusd.conf"
name = "infra-tusd | Install upstart file"
[[deploy.playbooks]]
hosts = "infra-tusd-server"
name = "Deploy infra-tusd"
[[deploy.playbooks.roles]]
# @todo On travis, we could directly use the generated
# /home/travis/gopath/src/github.com/tus/tusd/snapshot/tusd_linux_amd64.tar.gz
role = "{{{init.paths.roles_dir}}}/deploy/v1.4.0"
ansistrano_get_url = "https://github.com/tus/tusd/releases/download/0.1.2/tusd_linux_amd64.tar.gz"
ansistrano_deploy_to = "{{{config.global.approot}}}"

View File

@ -1,25 +0,0 @@
stop on runlevel [016]
start on (started networking)
# The respawn limits function as follows: If the process is respawned
# more than count times within an interval of timeout seconds,
# the process will be stopped automatically, and not restarted.
# Unless set explicitly, the limit defaults to 10 times within 5 seconds.
# http://upstart.ubuntu.com/wiki/Stanzas#respawn_limit
respawn
respawn limit 10 5
limit nofile 32768 32768
pre-stop exec status tusd | grep -q "stop/waiting" && initctl emit --no-wait stopped JOB=tusd || true
script
set -e
set -x
mkfifo /tmp/tusd-log-fifo
( logger -t tusd </tmp/tusd-log-fifo & )
exec >/tmp/tusd-log-fifo
rm /tmp/tusd-log-fifo
exec bash -c "cd /srv/tusd/current/tusd_linux_amd64/ \
&& exec sudo -EHu www-data ./tusd -port=8080 -dir=/mnt/tusd-data -store-size=10737418240"
end script