it create a swag container and docketsocket, need to get checked. it will ask you for email, domain, and cloudflare api token, no global api. After the container is created it update the cloudflare.ini with the api token and you just need to restart the container.
#!/bin/bash
######################################################################
Title : Install Swag with mods and cloudflare dns wildcare
By : DiscDuck/Taos15
License : General Public License GPL-3.0-or-later
Another fine product brought to you by IBRACORP™
######################################################################
Include ibrafunc for all the awesome functions
source /opt/ibracorp/ibramenu/ibrafunc.sh
App Info
app="swag" # App Name
title="swag" # Readable App Title
image="lscr.io/linuxserver/swag:latest" # Image and Tag
Parameters
parameters () {
msgbox "Setting Parameters for Your Setup"
tee <<-EOF
Please enter all parameters without any "".
EOF
read -p "Your Domain : " domain
read -p "Your Cloudflare api : " CF_API
read -p "Your Enamil : " email
}
App
local_appcreate () {
msgbox "Installing $title..."
mkdir -p /opt/appdata/$app && cd /opt/appdata/$app
msgbox "Making backups of .env and compose.yaml (if exist)"
if [ -f ".env" ]
then
mv .env .env.bak
fi
if [ -f "compose.yaml" ]
then
mv compose.yaml compose.yaml.bak
fi
tee <<-EOF > .env
APP_NAME=$app
IMAGE=$image
EOF
tee <<-EOF > compose.yaml
services:
dockerproxy:
container_name: dockerproxy
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
restart: unless-stopped
networks:
- ibranet
environment:
- CONTAINERS=1
- POST=0
swag:
image: \${IMAGE:?err}
container_name: \${APP_NAME:?err}
ports:
- '80:80'
- '443:443'
cap_add:
- NET_ADMIN
environment:
- URL=$domain
- TZ=America/New_York
- VALIDATION=dns
- SUBDOMAINS=wildcard
- DNSPLUGIN=cloudflare
- EMAIL=$email
- CF_API_TOKEN=$CF_API
- ONLY_SUBDOMAINS=false
- STAGING=true
- 'DOCKER_MODS=linuxserver/mods:universal-docker|linuxserver/mods:swag-auto-proxy'
- 'DOCKER_HOST=dockersocket '
- PUID=1000
- PGID=1000
env_file:
- .env
networks:
- ibranet
volumes:
- ./config:/config
restart: unless-stopped
security_opt:
- apparmor:unconfined
networks:
ibranet:
driver: bridge
external: true
EOF
chmod -R +x /opt/appdata/swag/
docker compose up -d --force-recreate
echo "your cloudflare.ini is been genarated, please restart the container"
echo dns_cloudflare_api_token = $CF_API > /opt/appdata/swag/config/dns-conf/cloudflare.ini
}
List Links
local_appfinalization () {
ibralogo
docker compose down
docker compose up -d --force-recreate
msgbox "All Done! Here is the link to $title:"
echo
echo
}
Execute
parameters
local_appcreate
local_appfinalization