-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#18 portainer added as start admin stack
- Loading branch information
Showing
8 changed files
with
147 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Ansible workflow for single service deployment. | ||
# Uses: https://github.com/dawidd6/action-ansible-playbook | ||
# Options: https://github.com/dawidd6/action-ansible-playbook/blob/master/main.js | ||
# Author: Just van den Broecke - 2021 | ||
# | ||
name: admin Deploy ⚙️ | ||
|
||
# Trigger only when services/admin subdir changed | ||
on: | ||
push: | ||
paths: | ||
- 'services/admin/**' | ||
|
||
jobs: | ||
main: | ||
runs-on: ubuntu-20.04 | ||
|
||
steps: | ||
- name: Checkout ✅ | ||
uses: actions/checkout@v2 | ||
|
||
- name: Run playbook ⚙ | ||
uses: dawidd6/action-ansible-playbook@v2 | ||
with: | ||
playbook: deploy.yml | ||
directory: ./ansible | ||
key: ${{secrets.ANSIBLE_SSH_PRIVATE_KEY}} | ||
inventory: ${{secrets.ANSIBLE_INVENTORY_PROD}} | ||
vault_password: ${{secrets.ANSIBLE_VAULT_PASSWORD}} | ||
options: | | ||
--tags admin | ||
--verbose |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Admin Stack | ||
|
||
Runs various admin tools/services. | ||
|
||
* Portainer (Community Edition) | ||
* GeoHealthCheck (TODO) | ||
|
||
## Deployment | ||
|
||
This service is automatically (re)deployed if anything within this directory or its subdirs changes | ||
when committed/pushed. | ||
|
||
A GitHub Action invokes an Ansible Playbook. | ||
See the following deployment files: | ||
|
||
* [GitHub Action](../../.github/workflows/deploy.admin.yml) | ||
* [Ansible Playbook](../../ansible/deploy.yml) | ||
|
||
The Ansible Playbook can also be invoked directly. | ||
|
||
## Specifics | ||
### Portainer | ||
|
||
* Image: https://hub.docker.com/r/portainer/portainer-ce/ | ||
|
||
**Admin Password** | ||
|
||
Encrypted version, generated with Apache Utils | ||
|
||
``` | ||
docker run --rm httpd:2.4-alpine htpasswd -nbB admin "THE PASSWORD" | cut -d ":" -f 2 | ||
``` | ||
|
||
Note escaped `$` in docker-compose.yml | ||
|
||
``` | ||
- --admin-password=$$2y$$05$$VCjhk4z8mhi8V0DpXHX56.W1jy0sNWHOwSQbXVCYPyLs/WanBODPq | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
|
||
source ../env.sh | ||
|
||
./stop.sh && docker pull portainer/portainer-ce:latest && ./start.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
version: '3.3' | ||
|
||
services: | ||
|
||
portainer: | ||
|
||
image: portainer/portainer-ce:latest | ||
|
||
container_name: portainer | ||
|
||
expose: | ||
- "9000" | ||
|
||
ports: | ||
- "9001:9000" | ||
|
||
command: | ||
- --admin-password=$$2y$$05$$VCjhk4z8mhi8V0DpXHX56.W1jy0sNWHOwSQbXVCYPyLs/WanBODPq | ||
|
||
volumes: | ||
- /var/run/docker.sock:/var/run/docker.sock | ||
- portainer_data:/data | ||
|
||
labels: | ||
# Enable Traefik routing on overlay service network | ||
- "traefik.enable=true" | ||
- "traefik.docker.network=service-network" | ||
|
||
- "traefik.http.middlewares.portainer-stripprefix.stripprefix.prefixes=/portainer" | ||
- "traefik.http.services.frontend.loadbalancer.server.port=9000" | ||
|
||
# SSL/https router | ||
- "traefik.http.routers.portainer_https.rule=Host(`${TRAEFIK_SSL_DOMAIN}`) && PathPrefix(`/portainer`)" | ||
- "traefik.http.routers.portainer_https.service=frontend" | ||
- "traefik.http.routers.portainer_https.entrypoints=https" | ||
- "traefik.http.routers.portainer_https.tls=${TRAEFIK_USE_TLS}" | ||
- "traefik.http.routers.portainer_https.tls.certresolver=${TRAEFIK_SSL_CERT_RESOLVER}" | ||
- "traefik.http.routers.portainer_https.tls.options=my_default@file" | ||
- "traefik.http.routers.portainer_https.middlewares=portainer-stripprefix,secure-headers@file" | ||
|
||
# local http router | ||
- "traefik.http.routers.portainer_http.service=frontend" | ||
- "traefik.http.routers.portainer_http.rule=Host(`localhost`) && PathPrefix(`/portainer`)" | ||
- "traefik.http.routers.portainer_http.entrypoints=http" | ||
- "traefik.http.routers.portainer_http.middlewares=portainer-stripprefix" | ||
|
||
volumes: | ||
portainer_data: | ||
|
||
networks: | ||
default: | ||
external: | ||
name: service-network |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/bash | ||
|
||
source ../env.sh | ||
|
||
./stop.sh | ||
docker-compose up -d |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/bash | ||
|
||
source ../env.sh | ||
|
||
docker-compose stop | ||
docker-compose rm --force |