Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating provisioner setup with docker compose #34

Merged
merged 4 commits into from
Apr 2, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
163 changes: 116 additions & 47 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,30 @@ services:
- ./certs:/certs

tinkerbell:
parauliya marked this conversation as resolved.
Show resolved Hide resolved
build: .
environment:
FACILITY: ${FACILITY:-lab1}
image: quay.io/tinkerbell/tink-pr:master
environment:
FACILITY: ${FACILITY:-onprem}
PACKET_ENV: ${PACKET_ENV:-testing}
PACKET_VERSION: ${PACKET_VERSION:-5efab5ef3a42cb88f2d54f4ed3201c2dd6797b7d}
ROLLBAR_TOKEN: ${ROLLBAR_TOKEN:-9b78d0ad01d1467aa92c49c3a349b79d}
ROLLBAR_DISABLE: ${ROLLBAR_DISABLE:-0}
MAX_WORKFLOW_DATA_VERSIONS: 5
PACKET_VERSION: ${PACKET_VERSION:-ignored}
ROLLBAR_TOKEN: ${ROLLBAR_TOKEN:-ignored}
ROLLBAR_DISABLE: ${ROLLBAR_DISABLE:-1}
PGDATABASE: tinkerbell
PGHOST: db
PGPASSWORD: tinkerbell
PGPORT: 5432
PGSSLMODE: disable
PGUSER: tinkerbell
depends_on:
- "certs"
- "db"
fluentbit:
condition: service_started
db:
condition: service_started
parauliya marked this conversation as resolved.
Show resolved Hide resolved
healthcheck:
test: ["CMD-SHELL", "wget -qO- 127.0.0.1:42114/cert"]
interval: 5s
timeout: 2s
retries: 30
volumes:
volumes:
- ./certs:/certs/${FACILITY}
logging:
driver: fluentd
Expand All @@ -47,17 +48,17 @@ services:
POSTGRES_USER: tinkerbell
ports:
- 5432:5432
depends_on:
- fluentbit
parauliya marked this conversation as resolved.
Show resolved Hide resolved
healthcheck:
test: ["CMD-SHELL", "pg_isready -U tinkerbell"]
interval: 1s
timeout: 1s
timeout: 1s
retries: 30
logging:
driver: fluentd
options:
tag: db
depends_on:
- fluentbit

cli:
parauliya marked this conversation as resolved.
Show resolved Hide resolved
build:
Expand All @@ -69,66 +70,86 @@ services:
driver: fluentd
options:
tag: tinkerbell-cli
depends_on:
parauliya marked this conversation as resolved.
Show resolved Hide resolved
- db
- tinkerbell
network_mode: host

registry:
build:
context: registry
args:
REGISTRY_USERNAME: username
REGISTRY_PASSWORD: password
environment:
args:
REGISTRY_USERNAME: $TINKERBELL_REGISTRY_USER
REGISTRY_PASSWORD: $TINKERBELL_REGISTRY_PASS
environment:
REGISTRY_HTTP_ADDR: 0.0.0.0:443
REGISTRY_HTTP_TLS_CERTIFICATE: /certs/server.pem
REGISTRY_HTTP_TLS_KEY: /certs/server-key.pem
REGISTRY_AUTH: htpasswd
REGISTRY_AUTH_HTPASSWD_REALM: "Registry Realm"
REGISTRY_AUTH_HTPASSWD_PATH: /auth/htpasswd
volumes:
volumes:
- ./certs:/certs
depends_on:
- fluentbit
logging:
driver: fluentd
options:
tag: registry
network_mode: host

boots:
build:
context: ../boots
image: quay.io/tinkerbell/boots-pr:master
network_mode: host
command: -dhcp-addr 0.0.0.0:67 -tftp-addr 127.0.0.1:69 -http-addr 127.0.0.1:80 -log-level DEBUG
command: -dhcp-addr 0.0.0.0:67 -tftp-addr $HOST_IP:69 -http-addr $HOST_IP:80 -log-level DEBUG
environment:
API_AUTH_TOKEN: ${PACKET_API_AUTH_TOKEN:-PcyR6MvHb7wMmyYf9p8dJ2Dvnb9HxX8E}
API_CONSUMER_TOKEN: ${PACKET_CONSUMER_TOKEN:-djR2TAvbnkY92i8Ea2KFMZW6MusW1fk7qzeCUHgtnQRSsXnqxoCr6V2vhSxpqASf}
FACILITY_CODE: ${FACILITY:-lab1}
API_AUTH_TOKEN: ${PACKET_API_AUTH_TOKEN:-ignored}
API_CONSUMER_TOKEN: ${PACKET_CONSUMER_TOKEN:-ignored}
FACILITY_CODE: ${FACILITY:-onprem}
PACKET_ENV: ${PACKET_ENV:-testing}
PACKET_VERSION: ${PACKET_VERSION:-5efab5ef3a42cb88f2d54f4ed3201c2dd6797b7d}
ROLLBAR_TOKEN: ${ROLLBAR_TOKEN:-9b78d0ad01d1467aa92c49c3a349b79d}
ROLLBAR_DISABLE: ${ROLLBAR_DISABLE:-0}
MIRROR_HOST: ${MIRROR_HOST:-127.0.0.1}
PACKET_VERSION: ${PACKET_VERSION:-ignored}
ROLLBAR_TOKEN: ${ROLLBAR_TOKEN:-ignored}
ROLLBAR_DISABLE: ${ROLLBAR_DISABLE:-1}
MIRROR_HOST: ${NGINX_IP:-127.0.0.1}
CACHER_GRPC_AUTHORITY: 127.0.0.1:42111
CACHER_CERT_URL: http://127.0.0.1:42112/cert
DNS_SERVERS: 8.8.8.8
PUBLIC_IP: 127.0.0.1
BOOTP_BIND: 127.0.0.1:67
HTTP_BIND: 127.0.0.1:80
SYSLOG_BIND: 127.0.0.1:514
TFTP_BIND: 127.0.0.1:69
DOCKER_REGISTRY: 127.0.0.1
REGISTRY_USERNAME: username
REGISTRY_PASSWORD: password
TINKERBELL_GRPC_AUTHORITY: 127.0.0.1:42113
TINKERBELL_CERT_URL: http://127.0.0.1:42114/cert
ELASTIC_SEARCH_URL: 127.0.0.1:9200
PUBLIC_IP: $HOST_IP
BOOTP_BIND: $HOST_IP:67
HTTP_BIND: $HOST_IP:80
SYSLOG_BIND: $HOST_IP:514
TFTP_BIND: $HOST_IP:69
DOCKER_REGISTRY: $HOST_IP
REGISTRY_USERNAME: $TINKERBELL_REGISTRY_USER
REGISTRY_PASSWORD: $TINKERBELL_REGISTRY_PASS
parauliya marked this conversation as resolved.
Show resolved Hide resolved
TINKERBELL_GRPC_AUTHORITY: $HOST_IP:42113
TINKERBELL_CERT_URL: http://$HOST_IP:42114/cert
ELASTIC_SEARCH_URL: $HOST_IP:9200
depends_on:
- tinkerbell
- cacher
parauliya marked this conversation as resolved.
Show resolved Hide resolved
- fluentbit
logging:
driver: fluentd
options:
tag: tinkerbell
driver: fluentd
options:
tag: boots
ports:
- 127.0.0.1:80:80/tcp
- $HOST_IP:80:80/tcp
- 67:67/udp
- 69:69/udp


nginx:
image: nginx:alpine
restart: unless-stopped
tty: true
ports:
- $NGINX_IP:80:80/tcp
volumes:
- /packet/nginx/:/usr/share/nginx/html/
logging:
driver: fluentd
options:
tag: nginx

elasticsearch:
image: elasticsearch:7.3.0
ports:
Expand All @@ -144,7 +165,7 @@ services:
- elasticsearch
restart: always
environment:
ELASTICSEARCH_URL: http://elasticsearch:9200
ELASTICSEARCH_HOSTS: http://elasticsearch:9200
ports:
- 5601:5601

Expand All @@ -158,3 +179,51 @@ services:
volumes:
- ./fluent-bit.conf:/fluent-bit/etc/fluent-bit.conf

cacher:
image: quay.io/packet/cacher:workflow
environment:
FACILITY: ${FACILITY:-onprem}
PACKET_API_AUTH_TOKEN: ${PACKET_API_AUTH_TOKEN}
PACKET_API_URL: ${PACKET_API_URL}
PACKET_CONSUMER_TOKEN: ${PACKET_CONSUMER_TOKEN-ignored}
PACKET_ENV: testing
PACKET_VERSION: ${PACKET_VERSION:-ignored}
PGDATABASE: tinkerbell
PGHOST: db
PGPASSWORD: tinkerbell
PGPORT: 5432
PGSSLMODE: disable
PGUSER: tinkerbell
ROLLBAR_TOKEN: ${ROLLBAR_TOKEN-ignored}
volumes:
- ./certs:/certs/${FACILITY}
logging:
driver: fluentd
options:
tag: cacher
depends_on:
- db
parauliya marked this conversation as resolved.
Show resolved Hide resolved
ports:
- 42111:42111/tcp
- 42112:42112/tcp

hegel:
image: quay.io/tinkerbell/hegel-pr:master
network_mode: host
environment:
ROLLBAR_TOKEN: ${ROLLBAR_TOKEN-ignored}
ROLLBAR_DISABLE: 1
PACKET_ENV: testing
PACKET_VERSION: ${PACKET_VERSION:-ignored}
GRPC_PORT: 42115
HEGEL_FACILITY: ${FACILITY:-onprem}
HEGEL_USE_TLS: 0
CACHER_CERT_URL: http://127.0.0.1:42112/cert
CACHER_GRPC_AUTHORITY: 127.0.0.1:42111
depends_on:
- cacher
parauliya marked this conversation as resolved.
Show resolved Hide resolved
- fluentbit
logging:
driver: fluentd
options:
tag: hegel
47 changes: 45 additions & 2 deletions docs/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

- Clone the `tinkerbell` repository for latest code:
```shell
$ git clone https://github.com/tinkerbell/tink.git
$ git clone https://github.com/packethost/tinkerbell.git
parauliya marked this conversation as resolved.
Show resolved Hide resolved
$ cd tinkerbell/terraform
```

Expand All @@ -14,9 +14,52 @@ $ terraform init
$ terraform apply
parauliya marked this conversation as resolved.
Show resolved Hide resolved
```

The above commands will create a complete setup with `tf-provisioner` and `tf-worker` machines on which you can run any workflow. As an output it returns the IP address of the provisioner and MAC address of the worker machine.
The above commands will create a complete setup with `tf-provisioner` and `tf-worker` machines for the `packet` provider which you can run any workflow. As an output it returns the IP address of the provisioner and MAC address of the worker machine.


**_Note_**: The default names of machines created by Terraform are `tf-provisioner` and `tf-worker`. If you prefer other names, you need to replace `tf-provisioner` and `tf-worker` with the new ones at all places in `main.tf`.
parauliya marked this conversation as resolved.
Show resolved Hide resolved


# Setup the Provisioner Machine directly with docker-compose.yml file


## Install git and git lfs as follows

1. ### Setup git and git lfs
```shell
$ sudo apt install -y git
$ wget https://github.com/git-lfs/git-lfs/releases/download/v2.9.0/git-lfs-linux-amd64-v2.9.0.tar.gz
$ tar -C /usr/local/bin -xzf git-lfs-linux-amd64-v2.9.0.tar.gz
$ rm git-lfs-linux-amd64-v2.9.0.tar.gz
$ git lfs install
2. ### Setup go
```shell
$ wget https://dl.google.com/go/go1.13.9.linux-amd64.tar.gz
$ tar -C /usr/local -xzf go1.13.9.linux-amd64.tar.gz go/
$ rm go1.12.13.linux-amd64.tar.gz
3. ### Set GOPATH
```shell
$ echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.bashrc
$ echo 'export GOPATH=$GOPATH:$HOME/go' >> ~/.bashrc
parauliya marked this conversation as resolved.
Show resolved Hide resolved
$ echo 'export PATH=$PATH:$GOPATH' >> ~/.bashrc
$ source ~/.bashrc

4. ### Install docker and docker-compose as follows:
```shell
$ curl -L get.docker.com | bash
$ curl -L "https://github.com/docker/compose/releases/download/1.24.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
$ chmod +x /usr/local/bin/docker-compose

5. ### Clone the tink repo in the $GOPATH
```shell
$ mkdir -p ~/go/src/github.com/tinkerbell
$ cd ~/go/src/github.com/tinkerbell
$ git clone https://github.com/tinkerbell/tink.git
$ cd tink

6. ### Provide the input details in "inputrc" file

7. ### Run the following command
```
$ sudo ./setup_with_docker_compose.sh

41 changes: 33 additions & 8 deletions fluent-bit.conf
Original file line number Diff line number Diff line change
Expand Up @@ -9,39 +9,64 @@
[OUTPUT]
Name es
Match db
Host 0.0.0.0
Host elasticsearch
Port 9200
Index db
Type db

[OUTPUT]
Name es
Match registry
Host 0.0.0.0
Host elasticsearch
Port 9200
Index registry
Type registry

[OUTPUT]
Name es
Match tinkerbell
Host 0.0.0.0
Match cacher
Host elasticsearch
Port 9200
Index tinkerbell
Type tinkerbell
Index cacher
Type cacher

[OUTPUT]
Name es
Match hegel
Host elasticsearch
Port 9200
Index hegel
Type hegel


[OUTPUT]
Name es
Match boots
Host elasticsearch
Port 9200
Index boots
Type boots

[OUTPUT]
Name es
Match tinkerbell-cli
Host 0.0.0.0
Host elasticsearch
Port 9200
Index tinkerbell-cli
Type tinkerbell-cli

[OUTPUT]
Name es
Match nginx
Host elasticsearch
Port 9200
Index nginx
Type nginx

[OUTPUT]
Name es
Match tinkerbell-server
Host 0.0.0.0
Host elasticsearch
Port 9200
Index tinkerbell-server
Type tinkerbell-server
9 changes: 9 additions & 0 deletions inputenv
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash
parauliya marked this conversation as resolved.
Show resolved Hide resolved

host_ip="192.168.1.1"
nginx_ip="192.168.1.2"
cidr="29"
broad_ip="192.168.1.7"
netmask="255.255.255.248"
private_registry_user="admin"
private_registry_pass="admin123"
Loading