This uses CoreOS, Etcd, Fleet and confd to provides distributed configuration and service discovery to Apollo api and web application.
This repo uses Vagrant and Virtualbox to create three CoreOS virtual machine.
- Virtualbox 4.3.10 or greater.
- Vagrant 1.6 or greater.
Copy user-data.sample
to user-data
.
cp user-data.sample user-data
Generate a new etcd
token here and
change discovery:
option in data-sample
.
Add your ssh public key in user-data
changing path
and content
as
the example.
- path: /home/core/.ssh/authorized_keys.d/<USERNAME-HERE>
permissions: 0600
owner: core
content: |
<SSH-RSA-KEY-HERE>
Copy config.rb.sample
to config.rb
cp config.rb.sample config.rb
Create a shared folder.
mkdir -p ~/.containers/apollo
Set the environment you are working on.
export APOLLO_ENVIRONMENT=local
export APOLLO_TAG=$APOLLO_ENVIRONMENT
export DOCKER_REGISTRY="${APOLLO_ENVIRONMENT}.registry.apollolab.com.br:5000"
export FLEETCTL_TUNNEL=172.16.16.101
It recommended to add it to ~/.bashrc
. It's used in other projects.
As root set more one ip address to eth0
.
ifconfig eth0:0 172.16.16.16
Add the following to ~/.ssh/config
:
Host apollo
User core
HostName 172.16.16.101
IdentityFile ~/.ssh/id_rsa.pub
Add your key:
ssh-add ~/.ssh/id_rsa
ssh-add ~/.vagrant.d/insecure_private_key
Check if it is correctly loaded:
ssh-add -l
It will start three nodes.
vagrant up
To get in a node use.
vagrant ssh apollo-01
You will need a local docker-registry
. For more info
see
List machines.
fleetctl list-machines
MACHINE IP METADATA
b3dac926... 172.16.16.101 -
Inside a machine run:
sudo coreos-cloudinit --from-file /var/lib/coreos-vagrant/vagrantfile-user-data