diff --git a/webhooks.py b/webhooks.py new file mode 100644 index 0000000..3154cd6 --- /dev/null +++ b/webhooks.py @@ -0,0 +1,80 @@ +import requests +import json +import getopt +import sys +try: + opts, args = getopt.getopt(sys.argv[1:], "amftDr:bd:sSO", ["command=", "help", "output="]) +except getopt.GetoptError as err: + #usage() + sys.exit(2) +output = None +# QJ : getopts +_MODE = "manual" +_FIRST = _TEST = _RESTORE = _BACKUP = _SYNC = _START = _STOP = False +_EXECUTE = True +_DATE = "pick" + +for o, a in opts: + if o == "-a": + _MODE = "auto" + elif o in ("-m", "--manual"): + _MODE = "manual" + elif o in ("-f", "--first"): + _FIRST = True + elif o in ("-d", "--date"): + _DATE = a + +url = "https://portainer.sectorq.eu/api/auth" +body = { + "password": "l4c1j4yd33Du5lo", + "username": "admin" +} + +x = requests.post(url, json=body) +# https://portainer.sectorq.eu/api/stacks/webhooks/02f5acae-1462-49d4-be3f-9d9c6a73a9ab +# https://portainer.sectorq.eu/api/stacks/webhooks/1b355925-5b71-48b5-8406-bc32a68d17ec + +cook = x.cookies +apikey = x.cookies.get_dict()["portainer_api_key"] +input(cook) +envs = {} + +headers = {"Authorization": "Bearer " + apikey} +input(headers) +url = "https://portainer.sectorq.eu/api/endpoints" +x = requests.get(url, cookies=cook) +data = json.loads(x.text) +for d in data: + print(d["Name"], " : ", d["Id"]) + envs[d["Id"]] = d["Name"] +print(envs) +url = "https://portainer.sectorq.eu/api/stacks" +x = requests.get(url, cookies=cook) +data = json.loads(x.text) +#print(data) +for d in data: + if d["Name"] == "bitwarden": + print(d) + #print(d) + print(d["EndpointId"]) + try: + print(d["Name"], " : ", envs[int(d["EndpointId"])], " : ", d["AutoUpdate"]["Webhook"]) + except: + print(d["Name"], " : ", envs[int(d["EndpointId"])], " : ", "") + + + +url = "https://portainer.sectorq.eu/api/webhooks" +x = requests.get(url, cookies=cook) +data = json.loads(x.text) +#print(data) + + + + +f = {'AutoUpdate': {'Interval': '', 'Webhook': '02f5acae-1462-49d4-be3f-9d9c6a73a9ab', 'JobID': '', 'ForceUpdate': False, 'ForcePullImage': True}} +print(headers) +url = "https://portainer.sectorq.eu/api/stacks/527/git" +x = requests.post(url, json=f, headers=headers) +print(x) +data = json.loads(x.text) \ No newline at end of file diff --git a/wordpress/.env b/wordpress/.env new file mode 100644 index 0000000..c2c470c --- /dev/null +++ b/wordpress/.env @@ -0,0 +1,2 @@ +APPNAME=wordpress +DOCKER_REGISTRY=r.sectorq.eu/library/ \ No newline at end of file diff --git a/wordpress/docker-compose.yml b/wordpress/docker-compose.yml new file mode 100644 index 0000000..07408c3 --- /dev/null +++ b/wordpress/docker-compose.yml @@ -0,0 +1,33 @@ +services: + db: + # We use a mariadb image which supports both amd64 & arm64 architecture + image: mariadb:10.6.4-focal + # If you really want to use MySQL, uncomment the following line + #image: mysql:8.0.27 + command: '--default-authentication-plugin=mysql_native_password' + volumes: + - db_data:/var/lib/mysql + restart: always + environment: + - MYSQL_ROOT_PASSWORD=somewordpress + - MYSQL_DATABASE=wordpress + - MYSQL_USER=wordpress + - MYSQL_PASSWORD=wordpress + expose: + - 3306 + - 33060 + wordpress: + image: wordpress:latest + volumes: + - wp_data:/var/www/html + ports: + - 80:80 + restart: always + environment: + - WORDPRESS_DB_HOST=db + - WORDPRESS_DB_USER=wordpress + - WORDPRESS_DB_PASSWORD=wordpress + - WORDPRESS_DB_NAME=wordpress +volumes: + db_data: + wp_data: \ No newline at end of file diff --git a/wordpress/stack.env b/wordpress/stack.env new file mode 100644 index 0000000..e69de29