Skip to content

Instantly share code, notes, and snippets.

View numpde's full-sized avatar

numpde

View GitHub Profile
@numpde
numpde / set_permissions.sh
Created October 23, 2024 07:54
WP/WC: Set file permissions on the host
#!/bin/bash
# This script updates file ownership and permissions for a WordPress installation
# located in the specified base directory. It ensures that the directories and files
# are owned by 'www-data', making them accessible for a WordPress instance running
# as 'www-data' inside a Docker container, while allowing the 'wc' user to edit them.
#
# The script performs the following actions:
# 1. Changes ownership of plugins, themes, uploads, wp-config.php, and .htaccess to 'www-data'.
# 2. Adds the 'wc' user to the 'www-data' group for edit permissions.
@numpde
numpde / wpwc_openapi_000_draft.yaml
Created October 14, 2024 05:15
OpenAPI for the WP/WC (by Schneider & Schuetz GmbH)
components:
schemas:
WPError:
properties:
additional_data:
description: Additional data of the error
type: any
additional_errors:
description: More errors
items:
@numpde
numpde / wpwc_openapi_001_basic_product_management.yaml
Created October 14, 2024 05:06
OpenAPI for the WP/WC (basic product management)
openapi: 3.1.0
info:
summary: OpenAPI for the WP/WC (basic product management). Based on the doc from the WP plug-in by Schneider & Schuetz GmbH.
title: wc/v3
version: '1'
servers:
- url: ***************************
security:
- basicAuth: []
components:
@numpde
numpde / docker-compose.yml
Last active October 21, 2024 16:18
WP/WC: WordPress
# Run as:
# TRAEFIK_IP=$(docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' traefik) docker-compose --env-file ./env/nairobi/.env -f ./marketplaces/nairobi/docker-compose.yml up -d
services:
wordpress:
image: wordpress:latest
container_name: wordpress_nairobi
restart: always
environment:
WORDPRESS_DB_HOST: "${MYSQL_HOST:?Please set MYSQL_HOST in .env or Docker Compose configuration.}"
@numpde
numpde / docker-compose.yml
Last active October 9, 2024 09:31
WP/WC: Adminer
services:
adminer:
image: adminer
container_name: adminer
environment:
- ADMINER_DEFAULT_SERVER=db_nairobi # MySQL container name on internal_nairobi network
labels:
- "traefik.enable=true"
- "traefik.http.routers.adminer.rule=Host(`${ADMINER_HOST}`)" # Uses host from env file
- "traefik.http.routers.adminer.entrypoints=websecure"
@numpde
numpde / docker-compose.yml
Created October 9, 2024 08:55
WP/WC: MySQL
services:
db_nairobi:
image: mysql:8.1
container_name: db_nairobi
restart: always
environment:
MYSQL_DATABASE: ${MYSQL_DATABASE}
MYSQL_USER: ${MYSQL_USER}
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
@numpde
numpde / docker-compose.yml
Last active October 11, 2024 15:45
WP/WC: Traefik
services:
traefik:
image: traefik:v3.1.4
container_name: traefik
restart: always
command:
- "--api.dashboard=true"
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--entrypoints.web.address=:80"
@numpde
numpde / create_wc_user.sh
Last active October 8, 2024 21:27
WP/WC: Create wc user
#!/bin/bash
# How to run:
# curl -s https://gist.githubusercontent.com/numpde/41349ac0a295402a5171c3976b331651/raw | bash -s "PASSWORD"
# Check if the password is provided
if [ $# -ne 1 ]; then
echo "Usage: $0 <password>"
exit 1
fi
@numpde
numpde / install_docker.sh
Last active October 8, 2024 20:59
WP/WC: Install docker
#!/bin/bash
# How-to: as root, run
# curl -s https://gist.githubusercontent.com/numpde/3e120f2c99f09b8852e005e33f46cb82/raw/?$(date +%s) | bash
# Update the package list
sudo apt update
# Install required dependencies
sudo apt install -y apt-transport-https ca-certificates curl software-properties-common
@numpde
numpde / update-systemd-resolved
Created October 8, 2024 06:56
/etc/openvpn/update-systemd-resolved
#!/bin/bash
#
# This script configures DNS settings for OpenVPN using systemd-resolved
# It uses D-Bus via busctl to communicate with systemd-resolved
# Ensure that systemd-resolved is running before using this script.
# Place this script at: /etc/openvpn/update-systemd-resolved
#
# Example OpenVPN config usage:
# up /etc/openvpn/update-systemd-resolved
# down /etc/openvpn/update-systemd-resolved