Skip to content

Instantly share code, notes, and snippets.

@mbejda mbejda/.env
Last active Apr 19, 2019

Embed
What would you like to do?
docker-compose.yml
DOMAIN=
MYSQL_ROOT_PASSWORD=
WORDPRESS_SITEURL=
WORDPRESS_HOME=
WORDPRESS_DB_NAME=
WORDPRESS_DB_USER=
WORDPRESS_DB_PASSWORD=
DB_PREFIX=
BACKUP_INTERVAL=
WORDPRESS_IMAGE=latest-alpine
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
S3_BUCKET=adping.io
#!/bin/bash
auth_email="$CF_EMAIL";
auth_key="$CF_TOKEN";
zone_identifier="$CF_ZONE";
record_name="$APP_DOMAIN";
ip="$IP";
# SCRIPT START
echo "[Cloudflare DDNS] Check Initiated"
echo "$record_name";
echo "{'type':'A','name':${record_name},'content':${ip},'ttl':{},'priority':10,'proxied':false}";
curl -X POST "https://api.cloudflare.com/client/v4/zones/$zone_identifier/dns_records" \
-H "X-Auth-Email: $auth_email" \
-H "X-Auth-Key: $auth_key" \
--ciphers ECDHE-RSA-AES128-GCM-SHA256 \
-H "Content-Type: application/json" \
--data '{"type":"A","name":"'"${record_name}"'","content":"'"${ip}"'","priority":10,"proxied":false}';
echo "DONE";
exit 1;
#!/bin/bash
auth_email="$CF_EMAIL";
auth_key="$CF_TOKEN";
zone_identifier="$CF_ZONE";
record_name="$APP_DOMAIN";
# SCRIPT START
echo "[Cloudflare DDNS] Check Initiated"
# Seek for the record
record=$(curl -s -X GET "https://api.cloudflare.com/client/v4/zones/$zone_identifier/dns_records?name=$record_name" -H "X-Auth-Email: $auth_email" -H "X-Auth-Key: $auth_key" -H "Content-Type: application/json")
# Can't do anything without the record
if [[ $record == *"\"count\":0"* ]]; then
>&2 echo -e "[Cloudflare DDNS] Record does not exist, perhaps create one first?"
exit 1
fi
# Get record IP Address
record_identifier=$(echo "$record" | grep -Po '(?<="id":")[^"]*' | head -1)
# The execution of update
delete=$(curl -s -X DELETE "https://api.cloudflare.com/client/v4/zones/$zone_identifier/dns_records/$record_identifier" -H "X-Auth-Email: $auth_email" -H "X-Auth-Key: $auth_key" -H "Content-Type: application/json");
echo $delete;
[Unit]
Description=Remove Cloudflare Records
Wants=network-online.target
After=network-online.target
[Service]
ExecStart=/bin/true
ExecStop=/root/init/cloudflare_delete_dns_record.sh
Type=oneshot
RemainAfterExit=yes
[Install]
WantedBy=multiuser.target
version: '3.4'
services:
nginx:
image: abiosoft/caddy
ports:
- "80:80"
- "8080:8080"
- "443:443"
links:
- wordpress
restart: on-failure
volumes:
- ./Caddyfile:/etc/Caddyfile
- ./.caddy:/etc/caddycerts
- logs:/var/log/caddy
networks:
- proxy_network
environment:
SERVER_NAMES: '${DOMAIN}'
wordpress:
container_name: wordpress
depends_on:
- db
image: wordpress:${WORDPRESS_IMAGE}
volumes:
- ~/init/upload.ini:/usr/local/etc/php/conf.d/upload.ini
- wp_themes:/var/www/html/wp-content/themes
- wp_plugins:/var/www/html/wp-content/plugins
- wp_uploads:/var/www/html/wp-content/uploads
restart: always
environment:
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_USER: admin
WORDPRESS_DB_PASSWORD: password
WORDPRESS_CONFIG_EXTRA: |
define( 'WP_DEBUG_LOG',true);
define('WP_CACHE', false );
define('WP_SITEURL', "${WORDPRESS_SITEURL}");
define('WP_HOME', "${WORDPRESS_HOME}");
networks:
- proxy_network
db:
image: mariadb:latest
restart: always
healthcheck:
test: "/usr/bin/mysql --user=admin --password=password --execute \"SHOW DATABASES;\""
interval: 3s
timeout: 1s
retries: 15
volumes:
- database:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: test
MYSQL_DATABASE: wordpress
MYSQL_USER: admin
MYSQL_PASSWORD: password
networks:
- proxy_network
volumes:
ssl_data:
nginx:
wp_plugins:
wp_themes:
wp_uploads:
wp_php:
database:
logs:
networks:
proxy_network:
file_uploads = On
memory_limit = 500M
upload_max_filesize = 200M
post_max_size = 200M
max_execution_time = 600
sudo curl -L https://github.com/docker/compose/releases/download/1.24.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose;
docker-compose --version;
mkdir ~/init && cd ~/init;
curl https://gist.githubusercontent.com/mbejda/a8f13f8e20dccd9ff8a406bfa40844a1/raw/5653024ead59508b6e98dae202068d2e3c922077/docker-compose.yml > ~/init/docker-compose.yml;
docker network create proxy_network;
docker-compose -f ~/init/docker-compose.yml up -d;
chown -R 33:33 /var/lib/docker/volumes/roothome_wp_themes;
chown -R 33:33 /var/lib/docker/volumes/roothome_wp_plugins;
chown -R 33:33 /var/lib/docker/volumes/roothome_wp_uploads;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.