-
-
Save kenperkins/ae50d416caa5486da80f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=App Redis Sidekick | |
Requires=docker.service | |
Requires=etcd.service | |
After=docker.service | |
After=etcd.service | |
After=app-redis.service | |
BindsTo=app-redis.service | |
[Service] | |
EnvironmentFile=/etc/environment | |
User=core | |
TimeoutStartSec=0 | |
ExecStart=/bin/bash -c '\ | |
while true; do \ | |
port=$(docker inspect --format=\'{{(index (index .NetworkSettings.Ports "6379/tcp") 0).HostPort}}\' app-redis.service); \ | |
timeout 1 bash -c "cat < /dev/null > /dev/tcp/${COREOS_PRIVATE_IPV4}/\"$port\""; \ | |
if [ $? -eq 0 ]; then \ | |
etcdctl set /services/app-redis/dfw ${COREOS_PRIVATE_IPV4}:$port --ttl 10; \ | |
else \ | |
etcdctl rm /services/app-redis/dfw; \ | |
fi; \ | |
sleep 5; \ | |
done' | |
ExecStop=/usr/bin/etcdctl rm /services/app-redis/dfw | |
[X-Fleet] | |
MachineOf=app-redis.service |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=App Redis | |
After=docker.service | |
Requires=docker.service | |
Requires=app-redis-sk.service | |
[Service] | |
EnvironmentFile=/etc/environment | |
TimeoutStartSec=0 | |
Restart=always | |
ExecStartPre=-/usr/bin/docker kill %n | |
ExecStartPre=-/usr/bin/docker rm %n | |
ExecStartPre=/usr/bin/docker pull redis | |
ExecStart=/usr/bin/docker run --name %n -p ${COREOS_PRIVATE_IPV4}::6379 redis:latest redis-server --requirepass XYZ1234 | |
ExecStop=/usr/bin/docker stop %n |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=App Service | |
Requires=docker.service | |
Requires=etcd.service | |
Requires=app-sk@%i.service | |
After=docker.service | |
After=etcd.service | |
[Service] | |
EnvironmentFile=/etc/environment | |
User=core | |
Restart=always | |
TimeoutStartSec=0 | |
ExecStartPre=-/usr/bin/docker kill %p-%i | |
ExecStartPre=-/usr/bin/docker rm %p-%i | |
ExecStartPre=/usr/bin/docker pull quay.io/user/app | |
ExecStart=/usr/bin/docker run --name %p-%i \ | |
-p ${COREOS_PRIVATE_IPV4}::3000 \ | |
-e REDIS_PASSWORD=XYZ1234 \ | |
-e DATACENTER=dfw \ | |
quay.io/user/app | |
ExecStop=/usr/bin/docker stop %p-%i | |
[X-Fleet] | |
Conflicts=app@*.service |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ubuntu:14.04 | |
MAINTAINER Ross Kukulinski "[email protected]" | |
RUN apt-get -qq update | |
RUN apt-get -qq install -y python-software-properties software-properties-common curl git build-essential supervisor emacs23-nox nano | |
RUN add-apt-repository -y ppa:chris-lea/node.js | |
RUN apt-get -qq update | |
RUN apt-get -qq install -y nodejs | |
RUN npm -g install npm | |
RUN npm -g install bower gulp grunt-cli bunyan | |
RUN mkdir -p /var/log/supervisor | |
ENTERYPOINT ["/usr/bin/node", "--version"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment