Richard Bucker

moving a project from a single dedicated host to a CoreOS installation

Posted at — Oct 2, 2015

After all that complaining I’m still going to try to move a project of mine from Rackspace to Digital Ocean and from Ubuntu to CoreOS.Right now I have a single etcd server and a single worker. The worker will run three containers; database data volume container, postgres database container, wepapp container (python 2.7).Get a discovery tokeycurl https://discovery.etcd.io/new?size=1Create the etcd server:#cloud-configcoreos:  etcd2:    # generate a new token for each unique cluster from https://discovery.etcd.io/new?size=3    # specify the initial size of your cluster with ?size=X    discovery: https://discovery.etcd.io/xxxxxxxxxxxxxxxxxxxxxxxxxxxx    # multi-region and multi-cloud deployments need to use $public_ipv4    advertise-client-urls: http://$private_ipv4:2379,http://$private_ipv4:4001    initial-advertise-peer-urls: http://$private_ipv4:2380    # listen on both the official ports and the legacy ports    # legacy ports can be omitted if your application doesn’t depend on them    listen-client-urls: http://0.0.0.0:2379,http://0.0.0.0:4001    listen-peer-urls: http://$private_ipv4:2380  fleet:    metadata: “role=services"  units:    - name: etcd2.service      command: start    - name: fleet.service      command: start  update:    # https://coreos.com/docs/cluster-management/setup/update-strategies/    reboot-strategy: etcd-lockCreate the worker:#cloud-configcoreos:  etcd2:    # use the same discovery token for the central service machines    # make sure you have used the discovery token to bootstrap the     # central service successfully    # this etcd will fallback to proxy automatically    discovery: https://discovery.etcd.io/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx    # listen on both the official ports and the legacy ports    # legacy ports can be omitted if your application doesn’t depend on them    listen-client-urls: http://0.0.0.0:2379,http://0.0.0.0:4001  fleet:    metadata: “role=worker"    etcd_servers: “http://localhost:2379"  locksmith:    endpoint: “http://localhost:2379"  units:    - name: etcd2.service      command: start    - name: fleet.service      command: start  update:    # https://coreos.com/docs/cluster-management/setup/update-strategies/    reboot-strategy: etcd-lockCreate the data volumedocker run –name local-postgres9.4 -e POSTGRES_PASSWORD=password -d –volumes-from postgres9.4-data postgres:9.4Create the database containerdocker run -it –link local-postgres9.4:postgres –rm postgres:9.4 sh -c ‘exec psql -h “$POSTGRES_PORT_5432_TCP_ADDR” -p “$POSTGRES_PORT_5432_TCP_PORT” -U postgres'Create the psql containerdocker run -it –link local-postgres9.4:postgres –rm postgres:9.4 sh -c ‘exec psql -h “$POSTGRES_PORT_5432_TCP_ADDR” -p “$POSTGRES_PORT_5432_TCP_PORT” -U postgres'What’s next?backup and restore the data from the original servercreate a webapp container and connect to the dbcreate a vulcand containercreate fleetctl service files and run