Skip to content

Commit

Permalink
Merge pull request #29 from Diesel-Net/development
Browse files Browse the repository at this point in the history
Promotion
  • Loading branch information
tomdaley92 authored Aug 13, 2022
2 parents e655854 + 4a7f8e8 commit 761622f
Show file tree
Hide file tree
Showing 17 changed files with 119 additions and 85 deletions.
9 changes: 0 additions & 9 deletions .ansible/ansible.cfg

This file was deleted.

4 changes: 1 addition & 3 deletions .ansible/deploy.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
# ansible-playbook deploy.yaml -i inventories/dev/hosts --vault-id ~/.tokens/master_id

- hosts: all
strategy: free
roles:
- common
- traefik

tasks:

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
all:
children:

manager:
swarm_manager:
hosts:
dev.diesel.net:

vars:
vars:
proxy_domains:
- dev.diesel.net
- dev.kiwi-labs.net

ansible_user: automation
ansible_python_interpreter: /usr/bin/python3
14 changes: 14 additions & 0 deletions .ansible/inventories/prod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
all:
children:

swarm_manager:
hosts:
prod.diesel.net:

vars:
proxy_domains:
- prod.diesel.net
- kiwi-labs.net

ansible_user: automation
ansible_python_interpreter: /usr/bin/python3
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
all:
children:

manager:
swarm_manager:
hosts:
test.diesel.net:

vars:
vars:
proxy_domains:
- test.diesel.net
- test.kiwi-labs.net

ansible_user: automation
ansible_python_interpreter: /usr/bin/python3
1 change: 0 additions & 1 deletion .ansible/inventory/development/group_vars/all/main.yaml

This file was deleted.

3 changes: 0 additions & 3 deletions .ansible/inventory/development/group_vars/manager/main.yaml

This file was deleted.

1 change: 0 additions & 1 deletion .ansible/inventory/production/group_vars/all/main.yaml

This file was deleted.

3 changes: 0 additions & 3 deletions .ansible/inventory/production/group_vars/manager/main.yaml

This file was deleted.

10 changes: 0 additions & 10 deletions .ansible/inventory/production/hosts

This file was deleted.

1 change: 0 additions & 1 deletion .ansible/inventory/stable/group_vars/all/main.yaml

This file was deleted.

3 changes: 0 additions & 3 deletions .ansible/inventory/stable/group_vars/manager/main.yaml

This file was deleted.

12 changes: 6 additions & 6 deletions .ansible/roles/requirements.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
- name: common
scm: git
src: "git@github.com:Diesel-Net/ansible-role-common.git"
version: 1.1.3

- name: docker
scm: git
src: "git@github.com:Diesel-Net/ansible-role-docker.git"
version: 1.3.0
version: 2.0.0

- name: traefik
scm: git
src: "git@github.com:Diesel-Net/ansible-role-traefik.git"
version: 2.0.0
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version: '3.8'
services:

main:
image: {{ docker_registry }}/{{ repository }}:{{ version }}-latest
image: {{ docker_image }}

environment:
- TITLE=Kiwi Labs
Expand All @@ -21,9 +21,9 @@ services:
- traefik.http.routers.coming-soon.tls.domains[0].sans={{ proxy_domains[0] }}
- traefik.http.routers.coming-soon.priority=1
networks:
- {{ docker_network }}
- {{ traefik_network }}

networks:
{{ docker_network }}:
{{ traefik_network }}:
external:
name: {{ docker_network }}
name: {{ traefik_network }}
106 changes: 80 additions & 26 deletions .drone.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
---
kind: pipeline
type: docker
name: Deploy coming-soon page
name: Deploy coming-soon page (dev)

clone:
depth: 1

concurrency:
limit: 1

steps:
- name: docker build & push (dev/test)
- name: docker build & push
image: plugins/docker
settings:
mirror: dockerhub.nexus.diesel.net
Expand All @@ -19,14 +22,37 @@ steps:
repo: docker.nexus.diesel.net/${DRONE_REPO_NAME}
tags:
- ${DRONE_BRANCH}-latest
when:
branch:
- development
- stable
event:
- push

- name: docker build & push (prod)

- name: deploy
image: docker.nexus.diesel.net/drone-ansible:2.13
settings:
galaxy: .ansible/roles/requirements.yaml
inventory: .ansible/inventories/dev.yaml
playbook: .ansible/deploy.yaml
private_key:
from_secret: automation_id_rsa
vault_password:
from_secret: ansible_vault_password

trigger:
branch:
- development
event:
- push

---
kind: pipeline
type: docker
name: Deploy coming-soon page (test)

clone:
depth: 1

concurrency:
limit: 1

steps:
- name: docker build & push
image: plugins/docker
settings:
mirror: dockerhub.nexus.diesel.net
Expand All @@ -37,35 +63,63 @@ steps:
from_secret: nexus_pass
repo: docker.nexus.diesel.net/${DRONE_REPO_NAME}
tags:
- production-latest
- ${DRONE_TAG}
when:
event:
- tag
- ${DRONE_BRANCH}-latest

- name: deploy
image: plugins/ansible:3
environment:
ANSIBLE_CONFIG: .ansible/ansible.cfg
image: docker.nexus.diesel.net/drone-ansible:2.13
settings:
playbook: .ansible/deploy.yaml
galaxy: .ansible/roles/requirements.yaml
inventory: .ansible/inventories/test.yaml
playbook: .ansible/deploy.yaml
private_key:
from_secret: automation_id_rsa
vault_password:
from_secret: ansible_vault_password
commands:
# dynamically select inventory based on Git branch/tag
- version=$DRONE_BRANCH
- if [ ! -z $DRONE_TAG ]; then version=production; fi
- /bin/drone-ansible --inventory .ansible/inventory/$$version/hosts


trigger:
branch:
- development
- stable
event:
- push

---
kind: pipeline
type: docker
name: Deploy coming-soon page (prod)

clone:
depth: 1

concurrency:
limit: 1

steps:
- name: docker build & push
image: plugins/docker
settings:
mirror: dockerhub.nexus.diesel.net
registry: docker.nexus.diesel.net
username:
from_secret: nexus_user
password:
from_secret: nexus_pass
repo: docker.nexus.diesel.net/${DRONE_REPO_NAME}
tags:
- production-latest
- ${DRONE_TAG}

- name: deploy
image: docker.nexus.diesel.net/drone-ansible:2.13
settings:
galaxy: .ansible/roles/requirements.yaml
inventory: .ansible/inventories/prod.yaml
playbook: .ansible/deploy.yaml
private_key:
from_secret: automation_id_rsa
vault_password:
from_secret: ansible_vault_password

trigger:
event:
- tag
...
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.ansible/roles/docker
.ansible/roles/common
.ansible/roles/application
.ansible/roles/traefik
.DS_Store
11 changes: 0 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,6 @@
# coming-soon
Thanks to [Creative Tim](http://www.creative-tim.com) for supplying a great [template](https://www.creative-tim.com/product/coming-sssoon-page) to work from.

## Installing External Dependencies
Ansible `2.10.3` was used at the time of this writing.
```bash
ansible-galaxy install -r .ansible/roles/requirements.yaml -p .ansible/roles --force
```

## Deploy
```bash
ansible-playbook .ansible/deploy.yaml -i .ansible/inventories/development/hosts --vault-id ~/.tokens/vault.txt
```

## Environment Variables

You have the following environment variables which allow you to configure the
Expand Down

0 comments on commit 761622f

Please sign in to comment.