diff --git a/CT-Build/Alpine.Jenkinsfile b/CT-Build/Alpine.Jenkinsfile index 51e33c9..541b161 100644 --- a/CT-Build/Alpine.Jenkinsfile +++ b/CT-Build/Alpine.Jenkinsfile @@ -1,4 +1,4 @@ -String[] ImgVariantList = ['minmal', 'default' , 'gitea' , 'nginx' ] +String[] ImgVariantList = ['minimal', 'default' , 'gitea' , 'nginx' , 'ddns' ] pipeline { agent { label 'LXCBuilder' } diff --git a/CT-Build/Alpine.yaml b/CT-Build/Alpine.yaml index 72e975d..5e2a34d 100644 --- a/CT-Build/Alpine.yaml +++ b/CT-Build/Alpine.yaml @@ -287,6 +287,13 @@ files: variants: - nginx +#FileForDdns +- path: /opt/Setup + generator: copy + source: CT-Files/ddns + variants: + - ddns + packages: manager: apk update: true @@ -321,6 +328,14 @@ packages: action: install variants: - gitea + + #PKGS for Ddns + - packages: + - ddclient@TestingEdge + - perl-data-validate-ip@TestingEdge + action: install + variants: + - ddns repositories: - name: /etc/apk/repositories @@ -328,8 +343,9 @@ packages: #StartREPOS http://192.168.2.83/alpine/v{{ image.release }}/main http://192.168.2.83/alpine/v{{ image.release }}/community - #EndREPOS - + #EndREPOS + {% if image.variant == "ddns" %}@TestingEdge http://dl-4.alpinelinux.org/alpine/edge/testing{% endif %} + actions: - trigger: post-unpack @@ -367,6 +383,7 @@ actions: variants: - gitea - nginx + - ddns mappings: architecture_map: alpinelinux diff --git a/CT-Files/ddns/Configs/ddclient.conf b/CT-Files/ddns/Configs/ddclient.conf new file mode 100644 index 0000000..df80644 --- /dev/null +++ b/CT-Files/ddns/Configs/ddclient.conf @@ -0,0 +1,7 @@ +#General config +daemon=600 +protocol=dyndns2 +server=www.ovh.com +use=web,web=ifconfig.me/ip +ssl=yes +password='DefaultPassword' \ No newline at end of file diff --git a/CT-Files/ddns/Scripts/AddDomain.sh b/CT-Files/ddns/Scripts/AddDomain.sh new file mode 100644 index 0000000..63795c5 --- /dev/null +++ b/CT-Files/ddns/Scripts/AddDomain.sh @@ -0,0 +1,44 @@ +#!/bin/ash +##Check if DefaultPassword has been set +if grep -q DefaultPassword /etc/ddclient/ddclient.conf; then + DefPass=$(tr -dc 'A-Za-z0-9!#%()*+,-.:;<=>?@[]^_{|}~' 2>/dev/null /root/DefaultDDNSPasswd + echo "The default password in ddns config is now: $DefPass" + echo "Please re-run the command to add a domain" + exit +fi + +#Get information about the domain +read -p "Enter domain to be added to DDNS: " domain +read -p "Enter the DDNS username for the domain: " username + +while true; do + read -p "Use default DDNS password Y/N? " yn + case $yn in + [Yy]* ) password=Default;break;; + [Nn]* ) read -p "Enter the DDNS password domain: " -s password;echo ''; break;; + * ) echo "Please answer yes or no.";; + esac +done + +#Update config +if test "$password" = "Default"; then +cat <> /etc/ddclient/ddclient.conf + +#$domain Config +login=$username +$domain +EOF +else +cat <> /etc/ddclient/ddclient.conf + +#$domain Config +login=$username +password='$password' +$domain +EOF +fi + +#Restart service +service ddclient restart diff --git a/CT-Files/ddns/Scripts/Init.sh b/CT-Files/ddns/Scripts/Init.sh new file mode 100644 index 0000000..aad4316 --- /dev/null +++ b/CT-Files/ddns/Scripts/Init.sh @@ -0,0 +1,9 @@ +#!/bin/ash +#Update configs +mv /opt/Setup/Configs/ddclient.conf /etc/ddclient/ddclient.conf +mv /opt/Setup/Scripts/AddDomain.sh /opt/AddDomain.sh +#add ddns service to startup +rc-update add ddclient + +#Update ReadMe +echo 'Use `ash /opt/AddDomain.sh` to add domains to ddns config' > ~/ReadMe \ No newline at end of file diff --git a/CT-Files/mysql/Scripts/FirstRun.sh b/CT-Files/mysql/Scripts/FirstRun.sh index e4748f5..3e6a30b 100644 --- a/CT-Files/mysql/Scripts/FirstRun.sh +++ b/CT-Files/mysql/Scripts/FirstRun.sh @@ -1,5 +1,5 @@ #!/bin/bash -read -p "Enter new password for mysql root: " -s NewMysqlPassword +read -p "Enter new password for mysql root: " -s NewMysqlPassword echo #StaticVars diff --git a/Readme.md b/Readme.md index 01fd910..452252d 100644 --- a/Readme.md +++ b/Readme.md @@ -76,4 +76,6 @@ Then select the created credential and click save 1. To configure the MySQL root password in the container run the setup script `bash /opt/Setup/Scripts/FirstRun.sh` ## gitea 1. Edit the parameters in the FistRun script in the container `vi /opt/Setup/Scripts/FirstRun.sh` -2. Run the FistRun scipt in the container `ash /opt/Setup/Scripts/FirstRun.sh` \ No newline at end of file +2. Run the FistRun scipt in the container `ash /opt/Setup/Scripts/FirstRun.sh` +# nginx +1. Run the FistRun scipt in the container `ash /opt/Setup/Scripts/FirstRun.sh` \ No newline at end of file