Install guide for Rancher on RancherOS

I haven’t found a guide on how to get Rancher on RancherOS. I’m looking for something like add the Rancher server to the cloud-config.yml that I use to install. Perhaps also some other settings, on how it’s best to get Rancher on RancherOS, and benefit from using RancherOS, instead of something else.

For example: what’s good practice and why, to start the rancher/server in system-docker or in docker?

Is there such a guide somewhere?

1 Like

For example, I’m trying out this could-config.yml:

#cloud-config
hostname: "foobar"

rancher:
    services:
        rancherserver:
            image: rancher/server
            restart: "always"
            ports:
                - "8080:8080"
ssh_authorized_keys:
    - "..."

And that adds the server, but how do I make the same machine also a host?

We have some notes on how to add in a rancher/agent, but this is assuming that it’s after your Rancher server is up.

You won’t be able to use one cloud config to add in rancher/server and rancher/agent onto 1 host as you need to find specific tokens AFTER rancher/server is up in order to add in a rancher/agent.

http://docs.rancher.com/os/running-rancher-on-rancheros/

1 Like

How about where to run rancher/server? I kind of feel it should run in system-docker, as to not appear in the running containers.

This is of course for my specific setup. What do you think?

You can put this in your cloud-config.yml for the server:

rancher:
  services:
    rancher-server1:
      image: rancher/server
      restart: always
      ports:
        - 8080:8080

And this for the agent:

  services:
    rancher-agent1:
      image: rancher/agent:v1.0.1
      command: http://10.0.2.10:8080/v1/projects/1a5/scripts/967D33DA6FB8035C83A9:1465534800000:3AJVEZWeyIfXb2fecHx36OrExow
      privileged: true
      volumes:
        - /var/run/docker.sock:/var/run/docker.sock

As you can see, cloud-config is mainly a docker-compose file, and for me it is the biggest benefice using RancherOS. And it’s size of course.

That config for the agent cannot be used. The IP of the host might differ. This can be solved by using “rancher-server1” from your config.

But the token, cannot be used. That is generated per agent.

I conclude that the agent can only be started manually.

Hey guy what you say? You’ve totally wrong.
the same command instruction can be used on any agents in the same environment.
I only gave an example, you can add many other parameters (see docker-compose documentation).

You mean that token is not different for each host?

The IP might work if you’re in the same network.

The token is not generated per agent. It’s generated per environment within Rancher server.

OK. Good to know. I misunderstood then. Sorry.

So the Agent can be configured only after install, since we can’t know the token before the install, right?

Correct, you can only configure agent after the rancher/server install.