Install docker following the Docker installation guide.
If your setup is behind proxies, you will need to define proxies if you want to upload upload images from external repositories.
For example on CentOS, you could create a file /etc/systemd/system/docker.service.d/http-proxy.conf
with this content :
[Service]
Environment="HTTP_PROXY=http://10.1.2.3:8080" "NO_PROXY=10.1.2.4,docker-registry.somecorporation.com"
Then flush changes and restart docker:
systemctl daemon-reload
systemctl restart docker
Before running a Yorc docker container, you will have to define its configuration. It can be done through different ways, that you can combine:
- command line flags
- environment variables
- a configuration file
Command line flags take precedence over environment variables, which take precedence over values defined in the configuration file.
See Yorc Server configuration documentation for details on how to configure the Yorc server using these three different methods.
This section will show the use of a configuration file. Create a file $HOME/yorc/config.yorc.yaml (json is supported as well), configuring the Yorc server so that it can deploy applications on different infrastructures, Google Cloud, OpenStack, AWS, Kubernetes, Slurm:
# Prefix on Compute Nodes that will be created on demand
resources_prefix: yorc-
# Ansible configuration
# Here using ssh instead of default paramiko for better performances
ansible:
debug: true
use_openssh: true
keep_operation_remote_path: true
keep_generated_recipes: true
hosted_operations:
unsandboxed_operations_allowed: true
# Path to a file describing locations that Yorc should connects to.
locations_file_path: /etc/yorc/locations.yaml
All properties defined above are described in the Yorc Server configuration documentation.
As you can see the supported locations are configured in a separate file. This file is read once during the initial cluster startup then it is ignored. This allows to have the same configuration for locations on all Yorc instances of the cluster. Locations can then be created/read/updated/deleted at runtime using the REST API or the CLI.
Locations are identified by their names that should be unique and several locations of the same type are supported.
Create a a location file $HOME/yorc/locations.yaml:
locations:
# Google Cloud configuration
- name: Google1
type: google
properties:
application_credentials: /etc/yorc/gcloud/my-project-service-account.json
project: my-project
# OpenStack Infrastructure settings
- name: OpenStackMyTenant
type: openstack
properties:
auth_url: http://10.1.2.3:5000/v2.0
tenant_name: mytenant
user_name: myuser
password: mypasswd
region: RegionOne
private_network_name: private-net
default_security_groups: [secgroup1,secgroup2]
# AWS Infrastructure
- name: aws
type: aws
properties:
region: us-east-2
access_key: ABCDEFABCEDFABCEDFAB
secret_key: lkipwrbmh+NDcoIVPChYgOcC/a8FfXPwhGZNOGWT
# Kubernetes Infrastructure settings
- name: kubernetes
type: kubernetes
properties:
ca_file: /etc/yorc/kubernetes/ca.pem,
cert_file: /etc/yorc/kubernetes/client.crt
key_file: /etc/yorc/kubernetes/client.key
master_url: https://10.1.2.40:6443
# Slurm Infrastructure setting
- name: slurm
type: slurm
properties:
user_name: root
private_key: /etc/yorc/slurm_private_key
url: 10.1.2.30
port: 22
Note that locations properties above are provided in plain text, but it is possible to keep them secret by storing them in a vault. See Yorc documentation on Hashicorp vault integration and configuration.
One type of infrastructure is not defined here, this is the Hosts Pool infrastructure.
The Hosts Pool infrastructure allows to register existing Compute nodes into a pool managed by Yorc. These compute nodes could be physical or virtual machines, containers or whatever as long as Yorc can SSH into it. You can add new nodes to the Hosts Pool at any time (or remove some, provided they are not allocated to a deployed application).
Nodes can be declared in a file, that you can modify at any time to add new nodes to the Hosts Pool, modify nodes descriptions, or remove some nodes provided these nodes to remove are not allocated to a deployed application.
Here is an example of a file declaring two hosts :
hosts:
- name: host1
connection:
user: myuser
private_key: /etc/yorc/secrets/id_rsa
host: 10.198.1.10
port: 22
labels:
environment: dev
host.cpu_frequency: 3 GHz
host.disk_size: 40 GB
host.mem_size: 4GB
host.num_cpus: "2"
os.architecture: x86_64
os.distribution: centos
os.type: linux
os.version: "7.3.1611"
private_address: "10.0.0.33"
public_address: "10.198.1.10"
public_ip_address: "10.198.1.10"
- name: host2
connection:
user: cloud-user
private_key: /etc/yorc/secrets/id_rsa
host: 10.198.1.11
port: 22
labels:
environment: dev
host.cpu_frequency: 3 GHz
host.disk_size: 40 GB
host.mem_size: 4GB
host.num_cpus: "2"
os.architecture: x86_64
os.distribution: centos
os.type: linux
os.version: "7.3.1611"
private_address: "10.0.0.36"
public_address: "10.198.1.11"
public_ip_address: "10.198.1.11"
You can apply this definition, running this command:
yorc hostspool apply -l hostspool mypooldefinition.yaml
Starting with Yorc 4.0.0 HostsPool can be describe in the location file like any other location.
Now that the configuration file $HOME/yorc/config.yorc.yaml
was created, the Yorc server
container can be started. This container expects to read its configuration from a
file under /etc/yorc
within the container (or from environment variables or CLI flags as explained above).
So we will mount the host directory $HOME/yorc
as /etc/yorc
on the container.
And use the image of Yorc 4.1.1 stored on docker hub at https://hub.docker.com/r/ystia/yorc/.
The port 8800 used by Yorc by default needs also to be exported.
It gives this command to start Yorc:
docker run -d \
--mount "type=bind,src=/home/cloud-user/yorc,dst=/etc/yorc" \
-p 8800:8800 --rm --name yorc --hostname yorc ystia/yorc:4.1.1
You can then see and follow Yorc server logs running this command:
docker logs --follow yorc
You can enter the container running :
docker exec -it yorc bash
Then start using yorc CLI :
$ yorc help
yorc is the main command, used to start the http server.
Yorc is a new generation orchestrator.
It is cloud-agnostic, flexible and secure.
Usage:
yorc [flags]
yorc [command]
Available Commands:
deployments Perform commands on deployments
help Help about any command
hostspool Perform commands on hosts pool
server Perform the server command
version Print the version
Flags:
-h, --help help for yorc
Use "yorc [command] --help" for more information about a command.
See more details in the documentation on Running Yorc in a docker container
Yorc is now installed.
You can skip next section on installing Yorc manually, and go to the section on how to install the UI companion of Yorc, Alien4Cloud.