mirror of
https://github.com/danog/yayponies-ipfs.git
synced 2024-11-26 11:54:42 +01:00
First commit
This commit is contained in:
commit
210dad5c10
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
[submodule "ypmirror"]
|
||||
path = ypmirror
|
||||
url = https://git.yayponies.pw/ypmirror.git
|
33
install.sh
Normal file
33
install.sh
Normal file
@ -0,0 +1,33 @@
|
||||
#!/bin/bash
|
||||
[ $(id -u) -ne 0 ] { echo "This script has to be run as root"; exit 1; }
|
||||
|
||||
service nginx stop
|
||||
rm /etc/nginx/sites-enabled/default
|
||||
rm /etc/nginx/conf.d/default
|
||||
|
||||
HTTP=" server {\n
|
||||
listen 80 default_server;\n
|
||||
listen [::]:80 default_server;\n
|
||||
server_name $DOMAIN;\n
|
||||
ssi on;\n
|
||||
root $PWD/yay;\n
|
||||
error_page 404 /sorry/404.php;\n
|
||||
error_page 403 /sorry/403.php;\n
|
||||
autoindex off;\n
|
||||
location / {\n
|
||||
index index.php index.html index.htm;\n
|
||||
error_page 404 /sorry/404.php;\n
|
||||
error_page 403 /sorry/403.php;\n
|
||||
}\n
|
||||
location ~ \.php$ {\n
|
||||
types { text/html php; }\n
|
||||
} \n
|
||||
}"
|
||||
echo -e $HTTP > /etc/nginx/conf.d/yp.conf
|
||||
service nginx start
|
||||
|
||||
co script.sh /usr/bin/yayponies-update.sh
|
||||
crontab -l > /tmp/yayponies-cron
|
||||
echo "*/10 * * * * /usr/bin/yayponies-update.sh $PWD localhost:8808" >> /tmp/yayponies-cron
|
||||
crontab /tmp/yayponies-cron
|
||||
rm /tmp/yayponies-cron
|
18
script.sh
Normal file
18
script.sh
Normal file
@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
cd $1/ypmirror
|
||||
git reset --hard
|
||||
git pull origin master
|
||||
|
||||
for f in $(find . -type f -name '*.php'); do
|
||||
curl "$2/$f" -so $f
|
||||
done
|
||||
|
||||
cd ..
|
||||
hash=$(ipfs name publish /ipfs/$(ipfs add -r ypmirror/ | sed '/ ypmirror$/!d;s/added //;s/ .*//g') | sed 's/:.*//g;s/Published to //g')
|
||||
echo "Create a DNS TXT record with value dnslink=/ipfs/$hash and name _dnslink.domain.name.
|
||||
Then configure it using https://www.cloudflare.com/distributed-web-gateway
|
||||
|
||||
Enjoy!
|
||||
|
||||
~Daniil Gentili"
|
||||
|
1
ypmirror
Submodule
1
ypmirror
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 5e5e9268aeccb78673a7f7b78a584394853d32df
|
Loading…
Reference in New Issue
Block a user