fititnt / cplp-aiops

AIOps para Comunidade dos Países de Língua Portuguesa, 2019/01. [Foco atual: servidores comunitário e gratuito para iniciantes em programação e ciência de dados]
The Unlicense
5 stars 0 forks source link

Tsuru #59

Open fititnt opened 5 years ago

fititnt commented 5 years ago

Discussões e commits relacionados ao "Tsuru", que no momento em que esse issue é inicalizado aplica-se ao Elefante Bornéu Águia Pescadora Charlie #58

fititnt commented 5 years ago

Arquivo config.yml

name: 'aguia-pescadora'
hosts:
    core:
        size: 1
        driver:
            options:
                generic-ip-address: ["192.99.69.2"]
                generic-ssh-key: ["/home/fititnt/.ssh/id_rsa-aguia-pescadora-tsuru"]
    apps:
        size: 1
        dedicated: false
        driver:
            options:
                generic-ip-address: ["192.99.69.2"]
                generic-ssh-key: ["/home/fititnt/.ssh/id_rsa-aguia-pescadora-tsuru"]
driver:
    name: generic
    options:
        generic-ssh-port: 22
        generic-ssh-user: root

Resultado de tsuru install-create -c config.yml

Nota: isso foi executado na minha máquina, mas com configurações de o que o tsuru deveria fazer na máquina remota. Eu to até impressionado que funcionou na segunda tentativa.

fititnt@bravo ~/t/tsuru> tsuru install-create -c config.yml
Running pre-install checks...
Creating CA: /home/fititnt/.tsuru/installs/aguia-pescadora/certs/ca.pem
Creating client certificate: /home/fititnt/.tsuru/installs/aguia-pescadora/certs/cert.pem
Running pre-create checks...
Error: failed to provision components machines: failed to provision machines: error creating machine failed to create host: Error with pre-create check: "SSH key does not exist: \"~/.ssh/id_rsa-aguia-pescadora-tsuru\""
fititnt@bravo ~/t/tsuru> ls -lha ~/.ssh/id_rsa-aguia-pescadora-tsuru
-rw------- 1 fititnt fititnt 3,2K Jun  2 23:18 /home/fititnt/.ssh/id_rsa-aguia-pescadora-tsuru
fititnt@bravo ~/t/tsuru> tsuru install-create -c config.yml
Running pre-install checks...
Running pre-create checks...
Creating machine...
(aguia-pescadora-1) Importing SSH key...
Waiting for machine to be running, this may take a few minutes...
Detecting operating system of created instance...
Waiting for SSH to be available...
Detecting the provisioner...
Provisioning with ubuntu(systemd)...
Installing Docker...
Copying certs to the local machine directory...
Copying certs to the remote machine...
Setting Docker configuration on the remote daemon...
Checking connection to Docker...
Docker is up and running!
Waiting for SSH to be available...
Detecting the provisioner...
Installing Docker...
Copying certs to the local machine directory...
Copying certs to the remote machine...
Setting Docker configuration on the remote daemon...
Creating registry certificate...
Uploading registry certificate...
Deploying tsuru config...
Deploying compose file in cluster manager....
Creating network tsuru_tsuru
Creating service tsuru_redis
Creating service tsuru_mongo
Creating service tsuru_planb
Creating service tsuru_registry
Creating service tsuru_tsuru
Restarting docker in aguia-pescadora-1
Waiting for SSH to be available...
Detecting the provisioner...
Waiting for Tsuru API to become responsive...
+Opening config file: /etc/tsuru/tsuru.conf
0Done reading config file: /etc/tsuru/tsuru.conf
OWarning: configuration didn't declare a database driver, using default driver.
@Using "mongodb" database "tsuru" from the server "mongo:27017".

Password: 

Confirm: 
 Root user successfully created.
Bootstrapping Tsuru API...adding target
New target aguia-pescadora -> http://192.99.69.2:8080 added to target list and defined as the current target
log in with default user: admin@example.com Password: 
Successfully logged in!
adding pool
Pool successfully registered.
adding node https://192.99.69.2:2376
Node successfully registered.
adding platform
Step 1/1 : FROM tsuru/python
latest: Pulling from tsuru/python
898c46f3b1a1: Pull complete 
63366dfa0a50: Pull complete 
041d4cd74a92: Pull complete 
6e1bee0f8701: Pull complete 
f1262cb8e4eb: Pull complete 
3b42147f93c6: Pull complete 
ce676a4695b2: Pull complete 
661010735481: Pull complete 
9adc416cb710: Pull complete 
750113562345: Pull complete 
17c03a3b10d3: Pull complete 
Digest: sha256:75cf3fb76cf6bb4614923e56a0581dc2b9a5fdc6cff54080a13774670248cedc
Status: Downloaded newer image for tsuru/python:latest
 ---> 2db4a6b12f34
Successfully built 2db4a6b12f34
Successfully tagged 192.99.69.2:5000/tsuru/python:v1
Platform successfully added!
adding team
Team "admin" successfully created!
adding dashboard
App "tsuru-dashboard" has been created!
Use app-info to check the status of the app and its units.
deploying dashboard
Deploying image... ok
---- Getting process from image ----
latest: Pulling from tsuru/dashboard
898c46f3b1a1: Already exists 
63366dfa0a50: Already exists 
041d4cd74a92: Already exists 
6e1bee0f8701: Already exists 
f1262cb8e4eb: Already exists 
3b42147f93c6: Already exists 
ce676a4695b2: Already exists 
8451f182be01: Pull complete 
08228282e2e2: Pull complete 
ece7284ab391: Pull complete 
74846b861d93: Pull complete 
58e30f14a771: Pull complete 
77f713733a5c: Pull complete 
4867c7fa9135: Pull complete 
17e3ccb375ed: Pull complete 
fc2fc7de3e1d: Pull complete 
ad6fe7455e89: Pull complete 
d962926909e2: Pull complete 
Digest: sha256:e49a7379e01643ed851680d69d87272490274424628e006b4117db3e22eef8e7
Status: Downloaded newer image for tsuru/dashboard:latest
---- Inspecting image "tsuru/dashboard:latest" ----
  ---> Process "web" found with commands: ["gunicorn --access-logfile - -b 0.0.0.0:$PORT -w 2 abyss.wsgi -k gevent"]
---- Getting tsuru.yaml from image ----
latest: Pulling from tsuru/dashboard
Digest: sha256:e49a7379e01643ed851680d69d87272490274424628e006b4117db3e22eef8e7
Status: Image is up to date for tsuru/dashboard:latest
---- Running build hooks ----
 ---> Running "python manage.py migrate --noinput && python manage.py createcachetable && python manage.py collectstatic --noinput"
latest: Pulling from tsuru/dashboard
Digest: sha256:e49a7379e01643ed851680d69d87272490274424628e006b4117db3e22eef8e7
Status: Image is up to date for tsuru/dashboard:latest
Operations to perform:
  Apply all migrations: contenttypes, sessions
Running migrations:
  No migrations to apply.
Cache table 'tsuru_cache' already exists.

0 static files copied to '/home/application/current/abyss/static', 204 unmodified.
---- Pushing image "192.99.69.2:5000/tsuru/app-tsuru-dashboard:v1" to tsuru ----
The push refers to repository [192.99.69.2:5000/tsuru/app-tsuru-dashboard]
d6ceda4c4656: Pushed 
691b5af91237: Pushed 
9fcbcb0d2d9c: Pushed 
8b7c9398215e: Pushed 
6c8b164a219a: Pushed 
4a7d5e6f8f02: Pushed 
0f8a11f8ed4b: Pushed 
a5e25c97cf5b: Pushed 
296e644b7d2c: Pushed 
f928ed1c7b60: Pushed 
095c21c108c6: Pushed 
c161a80a5f93: Mounted from tsuru/python 
b46b7be76795: Mounted from tsuru/python 
1e7aa790428a: Mounted from tsuru/python 
b57c79f4a9f3: Mounted from tsuru/python 
d60e01b37e74: Mounted from tsuru/python 
e45cfbc98a50: Mounted from tsuru/python 
762d8e1a6054: Mounted from tsuru/python 
v1: digest: sha256:12fc66d0e8a24c22a53f2c619b5e82150e8bf09298e81342b6db8010fb216fa4 size: 4091

---- Starting 1 new unit [web: 1] ----
 ---> Started unit 185b35a915 [web]

---- Binding and checking 1 new unit ----
 ---> healthcheck fail(185b35a915): Get http://192.99.69.2:32768/healthcheck/: EOF. Trying again in 3s
 ---> healthcheck successful(185b35a915)
 ---> Bound and checked unit 185b35a915 [web]

---- Adding routes to new units ----
 ---> Added route to unit 185b35a915 [web]

---- Setting router healthcheck (Path: /) ----

OK
Applying iptables workaround for docker 1.12...
Failed to apply iptables rule: ssh command error:
command : PATH=$PATH:/usr/sbin/:/usr/local/sbin; sudo iptables -D DOCKER-ISOLATION -i docker_gwbridge -o docker0 -j DROP
err     : exit status 1
output  : iptables: Bad rule (does a matching rule exist in that chain?).
. Maybe it is not needed anymore?
Failed to apply iptables rule: ssh command error:
command : PATH=$PATH:/usr/sbin/:/usr/local/sbin; sudo iptables -D DOCKER-ISOLATION -i docker0 -o docker_gwbridge -j DROP
err     : exit status 1
output  : iptables: Bad rule (does a matching rule exist in that chain?).
. Maybe it is not needed anymore?
--- Installation Overview ---
Core Hosts:
+-------------+-------+---------+
| IP          | State | Manager |
+-------------+-------+---------+
| 192.99.69.2 | ready | true    |
+-------------+-------+---------+

Core Components:
+----------------+-------+----------+
| Component      | Ports | Replicas |
+----------------+-------+----------+
| tsuru_planb    | 80    | 1        |
+----------------+-------+----------+
| tsuru_registry | 5000  | 1        |
+----------------+-------+----------+
| tsuru_tsuru    | 8080  | 1        |
+----------------+-------+----------+
| tsuru_mongo    |       | 1        |
+----------------+-------+----------+
| tsuru_redis    |       | 1        |
+----------------+-------+----------+
Configured default user:
Username: admin@example.com
Password: admin123
Apps Hosts:
+--------------------------+---------+--------+----------------------------------+
| Address                  | IaaS ID | Status | Metadata                         |
+--------------------------+---------+--------+----------------------------------+
| https://192.99.69.2:2376 |         | ready  | LastSuccess=2019-06-03T03:01:52Z |
|                          |         |        | pool=theonepool                  |
+--------------------------+---------+--------+----------------------------------+
Apps:
+-----------------+------------+------------------------------------+
| Application     | Units      | Address                            |
+-----------------+------------+------------------------------------+
| tsuru-dashboard | 1 starting | tsuru-dashboard.192.99.69.2.nip.io |
+-----------------+------------+------------------------------------+

Uso de disco logo após instalação do tsuru (com todos os componentes no mesmo nó)

root@aguia-pescadora-charlie:~# df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            1.9G     0  1.9G   0% /dev
tmpfs           385M  1.1M  384M   1% /run
/dev/sda1        39G  9.9G   29G  26% /
tmpfs           1.9G  444K  1.9G   1% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           1.9G     0  1.9G   0% /sys/fs/cgroup
/dev/sda15      105M  3.6M  101M   4% /boot/efi
tmpfs           385M     0  385M   0% /run/user/0
none             39G  9.9G   29G  26% /var/lib/docker/aufs/mnt/1eaeb7eb6ce2d0d89d80be1ba8e9edebcf108429f6caf71b70c675275139fd2d
shm              64M     0   64M   0% /var/lib/docker/containers/71459a29791975f2d1af65e8149715c1406d8826cdd5533afb7f35fd3def49f3/mounts/shm
none             39G  9.9G   29G  26% /var/lib/docker/aufs/mnt/39feb89e7ba334825042393fa2e78637b1b4939e93d763ed241dc4b9275c9b31
shm              64M     0   64M   0% /var/lib/docker/containers/33265c07bc617e4375f0cc30149d6350580f2114cf4b686b0d4ebfe1a73c4cc1/mounts/shm
none             39G  9.9G   29G  26% /var/lib/docker/aufs/mnt/30f1fcabcb7ba691b748acd77f75c64ce42d5dc5f38dd7a88901cfee0aa1ffb6
shm              64M     0   64M   0% /var/lib/docker/containers/095339211e48d80b7b09127f3ca93426882a3d143ad74adbd47ea1ea0e81a0da/mounts/shm
none             39G  9.9G   29G  26% /var/lib/docker/aufs/mnt/380e949e1f978a0d50fada91fd6ffe64ca9c0bf1ffeb3c0bc3b9a19a0866f76d
shm              64M     0   64M   0% /var/lib/docker/containers/3402124629f9723515aff0b4683da1215103dc868a3b76e2c54a9e32d8918f8d/mounts/shm
none             39G  9.9G   29G  26% /var/lib/docker/aufs/mnt/bacef4e7f71276cd7ff8a7ba1f9f8da3d8ea90886ad673eec6cd115c093c8d5b
shm              64M     0   64M   0% /var/lib/docker/containers/ddd851c5daef1915db455f20e170be5aee657a0948db6efa4d1c2cb3b1693fd0/mounts/shm
none             39G  9.9G   29G  26% /var/lib/docker/aufs/mnt/5feb51827182bb5b6c87404c5456d6dd8c3a0735bff30cbbc264bc38d6849514
shm              64M     0   64M   0% /var/lib/docker/containers/5ac7173f816b1ad4a6659cc7533448d59786b2565ee816030ea636333455cb71/mounts/shm
none             39G  9.9G   29G  26% /var/lib/docker/aufs/mnt/c8042d6e8b4ada4af87b9e80f745f5ceb46642eda2b51fde8d5f17282646c7a5
shm              64M     0   64M   0% /var/lib/docker/containers/185b35a9158dcce056938b11bb6cd58a63b746a16d77b9b16e180ab519a246b5/mounts/shm
root@aguia-pescadora-charlie:~# docker system df
TYPE                TOTAL               ACTIVE              SIZE                RECLAIMABLE
Images              9                   8                   2.946GB             2.257GB (76%)
Containers          12                  7                   3.709kB             20B (0%)
Local Volumes       4                   4                   1.002GB             0B (0%)
Build Cache         0                   0                   0B                  0B
fititnt commented 5 years ago

Captura de tela de 2019-06-03 00-12-43 Captura de tela de 2019-06-03 00-11-00 Captura de tela de 2019-06-03 00-11-16 Captura de tela de 2019-06-03 00-11-30 Captura de tela de 2019-06-03 00-11-49 Captura de tela de 2019-06-03 00-12-27

fititnt commented 5 years ago

Nota: a instalação do Tsuru alterou o hostname de de aguia-pescadora-charlie para aguia-pescadora-1, que é o nome especificado no arquivo config.yml (name: 'aguia-pescadora') + o sufixo "-1".

root@aguia-pescadora-1:~# hostname
aguia-pescadora-1
127.0.0.1   localhost
127.0.0.1   aguia-pescadora-charlie.etica.ai    aguia-pescadora-charlie
192.99.69.2 vps242916.vps.ovh.ca    vps242916
127.0.1.1 aguia-pescadora-1