Skip to content

Instantly share code, notes, and snippets.

@brandocorp
Created January 28, 2015 16:22
Show Gist options
  • Save brandocorp/06060c02ce44892c6be1 to your computer and use it in GitHub Desktop.
Save brandocorp/06060c02ce44892c6be1 to your computer and use it in GitHub Desktop.
CoreOS Setup
#cloud-config
coreos:
etcd:
discovery: https://discovery.etcd.io/660d695900f203da9f9819cf42775896
addr: $public_ipv4:4001
peer-addr: $public_ipv4:7001
fleet:
public-ip: $public_ipv4 # used for fleetctl ssh command
units:
- name: etcd.service
command: start
- name: fleet.service
command: start
global
log 127.0.0.1 local0
log 127.0.0.1 local1 notice
maxconn 4096
daemon
defaults
log global
mode http
option httplog
option dontlognull
option forwardfor
option http-server-close
stats enable
stats auth admin:password
stats uri /stats
frontend http-in
bind *:80
acl jenkins_subdomain hdr(host) -i jenkins.brandonraa.be
use_backend jenkins_host if jenkins_subdomain
backend jenkins_host
option httpclose
option forwardfor
server jenkins.brandonraa.be 127.0.0.1:8080 check
[Unit]
Description=HAProxy
After=docker.service
After=etcdctl.service
[Service]
TimeoutStartSec=0
ExecStartPre=-/usr/bin/docker kill haproxy
ExecStartPre=-/usr/bin/docker rm haproxy
ExecStartPre=/usr/bin/docker pull haproxy
ExecStart=/usr/bin/docker run --name haproxy -p 80:80 -v /home/core/services/haproxy:/usr/local/etc/haproxy haproxy haproxy -db -f /usr/local/etc/haproxy/haproxy.cfg
ExecStop=/usr/bin/docker stop haproxy
[Unit]
Description=Jenkins
After=docker.service
After=etcdctl.service
[Service]
TimeoutStartSec=0
ExecStartPre=-/usr/bin/docker kill jenkins
ExecStartPre=-/usr/bin/docker rm jenkins
ExecStartPre=/usr/bin/docker pull jenkins
ExecStart=/usr/bin/docker run --name jenkins -p 8080:8080 -v /home/core/services/jenkins:/var/jenkins_home jenkins
ExecStop=/usr/bin/docker stop jenkins
for svc in jenkins haproxy; do
mkdir -p /home/core/services/${svc}
docker pull $svc
touch services/${svc}.service
done
fleetctl load jenkins.service
fleetctl start jenkins.service
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment