This commit is contained in:
2023-09-26 18:14:36 -06:00
commit fb5a0fc542
443 changed files with 21892 additions and 0 deletions

110
DroneCI/.drone.yml Normal file
View File

@@ -0,0 +1,110 @@
---
kind: pipeline
type: docker
name: deploy
environment:
PACKAGE: DroneCI
URL: drone.alexlebens.net
steps:
- name: Tests
image: ps03fd.alexlebens.net:5000/droneimage:latest
commands:
- /scripts/tests.sh
- name: Nofification > Discord | Tests - Failure
image: appleboy/drone-discord
settings:
webhook_id:
from_secret: discord_webhook_id
webhook_token:
from_secret: discord_webhook_token
username: DroneCI - ps03fd
message: Docker compose validation for DroneCI failed.
when:
status:
- failure
- name: Configuration
image: ps03fd.alexlebens.net:5000/droneimage:latest
commands:
- mkdir ~/.ssh/
- echo "$SSH_KEY" > ~/.ssh/id_rsa
- chmod 600 ~/.ssh/id_rsa
- ssh-keyscan -H $HOST_IP >> ~/.ssh/known_hosts
- /scripts/configuration.sh
environment:
SSH_KEY:
from_secret: ssh_key_ps03fd_drone
DOCKER_HOST:
from_secret: docker_host_ps03fd
HOST_IP:
from_secret: host_ip_ps03fd
UPTIMEKUMA_NAME:
from_secret: uptimekuma_name
UPTIMEKUMA_PASSWORD:
from_secret: uptimekuma_password
UPTIMEKUMA_URL:
from_secret: uptimekuma_url
when:
branch:
- main
- name: Nofification > Discord | Configuration - Failure
image: appleboy/drone-discord
settings:
webhook_id:
from_secret: discord_webhook_id
webhook_token:
from_secret: discord_webhook_token
username: DroneCI - ps03fd
message: Configuration for DroneCI failed.
when:
status:
- failure
- name: Deploy
image: ps03fd.alexlebens.net:5000/droneimage:latest
commands:
- mkdir ~/.ssh/
- echo "$SSH_KEY" > ~/.ssh/id_rsa
- chmod 600 ~/.ssh/id_rsa
- ssh-keyscan -H $HOST_IP >> ~/.ssh/known_hosts
- /scripts/deploy.sh
environment:
SSH_KEY:
from_secret: ssh_key_ps03fd_drone
DOCKER_HOST:
from_secret: docker_host_ps03fd
HOST_IP:
from_secret: host_ip_ps03fd
when:
branch:
- main
- name: Nofification > Discord | Deploy - Success
image: appleboy/drone-discord
settings:
webhook_id:
from_secret: discord_webhook_id
webhook_token:
from_secret: discord_webhook_token
username: DroneCI - ps03fd
message: Docker compose deployment for DroneCI succeeded
when:
status:
- sucess
- name: Nofification > Discord | Deploy - Failure
image: appleboy/drone-discord
settings:
webhook_id:
from_secret: discord_webhook_id
webhook_token:
from_secret: discord_webhook_token
username: DroneCI - ps03fd
message: Docker compose deployment for DroneCI failed.
when:
status:
- failure

7
DroneCI/.env Normal file
View File

@@ -0,0 +1,7 @@
DRONE_GITEA_SERVER=https://gitea.alexlebens.net
DRONE_GITEA_CLIENT_ID=7c34bd96-3dd6-4d29-aef8-193df1fc9d71
DRONE_GITEA_CLIENT_SECRET=gto_ylpzlyzggy3cd6lrynbmcyzy6mgevruulaktwckyvxq3q5i37xea
DRONE_RPC_SECRET=c4060eb0bb4e7ab9f5cdeb5fa87698f7
DRONE_SERVER_HOST=https://drone.alexlebens.net
DRONE_SERVER_PROTO=https
DRONE_USER_CREATE=username:alexlebens,admin:true

4
DroneCI/.run.env Normal file
View File

@@ -0,0 +1,4 @@
DRONE_RPC_PROTO: http
DRONE_RPC_HOST: 172.22.0.11
DRONE_RPC_SECRET: c4060eb0bb4e7ab9f5cdeb5fa87698f7
DRONE_RUNNER_CAPACITY: 2

3
DroneCI/README.md Normal file
View File

@@ -0,0 +1,3 @@
# DroneCI
[![Build Status](https://drone.alexlebens.net/api/badges/alexlebens/DroneCI/status.svg)](https://drone.alexlebens.net/alexlebens/DroneCI)

View File

@@ -0,0 +1,17 @@
{
"type": "docker",
"name": "DroneCI - Docker",
"interval": 60,
"retryInterval": 20,
"maxretries": 1,
"notificationIDList": [
3,
4
],
"url": "https://drone.alexlebens.net",
"accepted_statuscodes": [
"200-299"
],
"docker_container": "drone",
"docker_host": 1
}

View File

@@ -0,0 +1,17 @@
{
"type": "docker",
"name": "DroneCI Runner 1 - Docker",
"interval": 60,
"retryInterval": 20,
"maxretries": 1,
"notificationIDList": [
3,
4
],
"url": "https://drone.alexlebens.net",
"accepted_statuscodes": [
"200-299"
],
"docker_container": "drone_runner_1",
"docker_host": 1
}

View File

@@ -0,0 +1,17 @@
{
"type": "docker",
"name": "DroneCI Runner 2 - Docker",
"interval": 60,
"retryInterval": 20,
"maxretries": 1,
"notificationIDList": [
3,
4
],
"url": "https://drone.alexlebens.net",
"accepted_statuscodes": [
"200-299"
],
"docker_container": "drone_runner_2",
"docker_host": 1
}

View File

@@ -0,0 +1,15 @@
{
"type": "http",
"name": "DroneCI - Web",
"interval": 60,
"retryInterval": 20,
"maxretries": 1,
"notificationIDList": [
3,
4
],
"url": "https://drone.alexlebens.net",
"accepted_statuscodes": [
"200-299"
]
}

View File

@@ -0,0 +1,91 @@
services:
drone:
container_name: drone
env_file:
- .env
image: drone/drone:latest
labels:
traefik.docker.network: traefik
traefik.enable: true
traefik.http.routers.drone.entrypoints: websecure
traefik.http.routers.drone.rule: Host(`drone.alexlebens.net`)
traefik.http.routers.drone.service: drone
traefik.http.services.drone.loadbalancer.server.port: 80
logging:
driver: json-file
options:
max-size: 50m
max-file: "3"
networks:
drone:
ipv4_address: 172.22.0.11
traefik: null
restart: always
volumes:
- drone_data:/data
drone_runner_1:
container_name: drone_runner_1
depends_on:
- drone
env_file:
- .run.env
environment:
DRONE_RUNNER_NAME: drone_runner_1
DRONE_RUNNER_NETWORKS: traefik
image: drone/drone-runner-docker:latest
logging:
driver: json-file
options:
max-size: 50m
max-file: "3"
networks:
drone:
ipv4_address: 172.22.0.12
privileged: true
restart: always
volumes:
- /var/run/docker.sock:/var/run/docker.sock
drone_runner_2:
container_name: drone_runner_2
depends_on:
- drone
env_file:
- .run.env
environment:
DRONE_RUNNER_NAME: drone_runner_2
DRONE_RUNNER_NETWORKS: traefik
image: drone/drone-runner-docker:latest
logging:
driver: json-file
options:
max-size: 50m
max-file: "3"
networks:
drone:
ipv4_address: 172.22.0.13
privileged: true
restart: always
volumes:
- /var/run/docker.sock:/var/run/docker.sock
networks:
traefik:
name: traefik
external: true
drone:
name: drone
external: false
ipam:
config:
- subnet: 172.22.0.0/16
volumes:
drone_data:
driver: local
driver_opts:
type: none
o: bind
device: /var/lib/docker/volumes/partition/drone_data