Core-os
Zur Navigation springen
Zur Suche springen
docker cluster
- user-data
#cloud-config --- coreos: etcd: addr: $public_ipv4:4001 peer-addr: $public_ipv4:7001 discovery: https://discovery.etcd.io/122baeb3e193ecb09023ce27a508860b etcd2: advertise-client-urls: http://$public_ipv4:2379 initial-advertise-peer-urls: http://$private_ipv4:2380 listen-client-urls: http://0.0.0.0:2379,http://0.0.0.0:4001 listen-peer-urls: http://$private_ipv4:2380,http://$private_ipv4:7001 discovery: https://discovery.etcd.io/122baeb3e193ecb09023ce27a508860b fleet: public-ip: $public_ipv4 flannel: interface: $public_ipv4 units: - name: etcd.service command: start - name: fleet.service command: start - name: docker-tcp.socket command: start enable: true content: | [Unit] Description=Docker Socket for the API [Socket] ListenStream=2375 Service=docker.service BindIPv6Only=both [Install] WantedBy=sockets.target - name: httpd.service command: start enable: true content: | [Unit] Description=httpd Requires=docker.service After=docker.service [Service] ExecStart=/usr/bin/docker run -d -p 80:80 --name own-httpd httpd [Install] WantedBy=multi-user.target
$num_instances=3 $new_discovery_url="https://discovery.etcd.io/new?size=#{$num_instances}" if File.exists?('user-data') && ARGV[0].eql?('up') require 'open-uri' require 'yaml' token = open($new_discovery_url).read data = YAML.load(IO.readlines('user-data')[1..-1].join) if data['coreos'].key? 'etcd' data['coreos']['etcd']['discovery'] = token end if data['coreos'].key? 'etcd2' data['coreos']['etcd2']['discovery'] = token end yaml = YAML.dump(data) File.open('user-data', 'w') { |file| file.write("#cloud-config\n\n#{yaml}") } end $update_channel='stable' #$vm_gui = true $vm_memory = 1024 $vm_cpus = 1
- core@core-01 ~ $ cat CoreGi.service
[Unit] Description=CoreGI After=docker.service Requires=docker.service [Service] EnvironmentFile=/etc/environment User=core TimeoutStartSec=0 ExecStartPre=-/usr/bin/docker kill coregi ExecStartPre=-/usr/bin/docker rm coregi ExecStartPre=/usr/bin/docker pull yodlr/coregi:latest ExecStart=/usr/bin/docker run --name coregi \ -p 3000:3000 \ -v /usr/bin/fleetctl:/usr/bin/fleetctl \ yodlr/coregi:latest ExecStop=/usr/bin/docker stop coregi [X-Fleet] Global=True
- fleetctl stop CoreGi.service
- fleetctl start CoreGi.service
- fleetctl destroy CoreGi.service
- fleetctl start CoreGi.service
- fleetctl list-units