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

adds demo project ansible role to automate deploying this project fro… #25

Merged
merged 1 commit into from Apr 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -5,3 +5,5 @@
packet_key
packet_key.pub
3-cluster-inventory.tf
example/deploy_demo/inventory.yaml
example/deploy_demo/main.retry
2 changes: 1 addition & 1 deletion 2-clusters.tf
@@ -1,6 +1,6 @@
#Your Initial Cluster is defined here, subsequent clusters inventoried in 3-cluster-inventory.tf, created by Makefile
module "cluster_facility" {
source = "modules/cluster_pool"
source = "./modules/cluster_pool"

cluster_name = "primary"
count = "${var.count}"
Expand Down
16 changes: 16 additions & 0 deletions README.md
Expand Up @@ -61,3 +61,19 @@ module "cluster_name_nrt1" {
}
```
This creates a single-controller cluster, with `count` number of agent nodes in `facility`.

<h3>Demo Project</h3>

In `example/`, there are files to configure and deploy a demo project that, once your request is received, returns the IP of the cluster serving your request to demonstrate the use of Packet's Global IPv4 addresses to distribute traffic globally to your edge cluster deployments.

To run the project, you can run the `deploy_demo` Ansible project by running the `create_inventory.sh` script to gather your cluster controller IPs into your inventory for Ansible:

```
cd example/
sh create_inventory.sh
cd deploy_demo
ansible-playbook -i inventory.yaml main.yml
```

or manually copy `example/deploy_demo/roles/demo/files/traefik.sh` to your `kubectl` client machine and run manually to deploy Traefik and the application.

File renamed without changes.
11 changes: 11 additions & 0 deletions example/README.md
Expand Up @@ -34,6 +34,17 @@ This is a small demo Flask application, and is downloaded from Docker Hub as `jm
Deploy
==

Run `create_inventory.sh` to generate a hosts inventory, and then in the `deploy_demo` Ansible directory, you can apply the apply:

```
sh create_inventory.sh
cd deploy_demo
ansible-playbook -i inventory.yaml main.yml
```

or manually copy `example/deploy_demo/roles/demo/files/traefik.sh` to your `kubectl` client machine and run manually to deploy Traefik and the application.


The `trafik.sh` script will deploy the application as a DaemonSet on your cluster, and expose this through an ingress on port 80, by default, so from there, you can access the application (and verify the distribution of requests through the Anycast IP) using:

```
Expand Down
6 changes: 6 additions & 0 deletions example/create_inventory.sh
@@ -0,0 +1,6 @@
#!/bin/bash

echo "[controllers]" | tee deploy_demo/inventory.yaml && \

for host in `cd ../ ; terraform state list | grep primary | xargs -n1 -I% terraform state show % | grep network.0.address | awk '{print $3}'` ; do \
echo root@$host | tee -a deploy_demo/inventory.yaml ; done
6 changes: 6 additions & 0 deletions example/deploy_demo/main.yml
@@ -0,0 +1,6 @@
---
- hosts:
- controllers
become: true
roles:
- demo
File renamed without changes.
8 changes: 8 additions & 0 deletions example/deploy_demo/roles/demo/tasks/main.yml
@@ -0,0 +1,8 @@
---
- name: copy deploy script
copy:
src: files/traefik.sh
dest: /root/traefik.sh
mode: 755
- name: run deploy script
command: sh /root/traefik.sh
2 changes: 0 additions & 2 deletions example/requirements.txt

This file was deleted.