Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


I wrote a shell script that turns spare VPS into a CDN node in one click - Page 2
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

I wrote a shell script that turns spare VPS into a CDN node in one click

2

Comments

  • @mrclown said:
    This could be another beginning like CENTMINMOD if maintained it well. But CDN doesn't work alone, need a good cluster to work together with fair amount of control and monitoring.

    This script is just a cache/reverse-proxy. Would be good to rename or extend to support bigger scale as a vision. Otherwise gonna mislead more people to compare with cloudflare, bunny and etc.

    We can just buy a couple of anycast vps across the world like at buyvm & set this up for the beginnings of a cdn & it will work like one, like what others said in the thread, this is a great script to get started.

  • yokowasisyokowasis Member
    edited July 2020

    @mrclown said:

    @yokowasis said:
    Is this work like cloud flare where the cdn sit between the origin and automatically cache static resource, or some thing like bunnycdn?

    This is just installation script. ATS works like any other cache which is used by CF or bunny. Of cuz there'll be performance differences depending on what stack and how much optimization was made across their deployment.

    For simple setup, this script will help for beginners. In production setup, that needs to tune properly.

    Cloudflare and BunnyCDN, while they both CDN, work very differently.

    in Cloudflare you don't need to do anything. Just use their DNS service. in BunnyCDN, you need to change your software path to their domain or your custom domain. The point si, you CANNOT use existing domain with BunnyCDN, you must use dedicated domain for the cdn, which require some tuning within the softare.

    I am not aware any other service or software that works like cloudflare. If this is one, then it's Great.

    Also I am assuming this come with DNS Server, right ?
    Also does it have API for purging the cache ?

  • mrclownmrclown Member
    edited July 2020

    @yokowasis said:

    @mrclown said:

    @yokowasis said:
    Is this work like cloud flare where the cdn sit between the origin and automatically cache static resource, or some thing like bunnycdn?

    This is just installation script. ATS works like any other cache which is used by CF or bunny. Of cuz there'll be performance differences depending on what stack and how much optimization was made across their deployment.

    For simple setup, this script will help for beginners. In production setup, that needs to tune properly.

    Cloudflare and BunnyCDN, while they both CDN, work very differently.

    in Cloudflare you don't need to do anything. Just use their DNS service. in BunnyCDN, you need to change your software path to their domain or your custom domain. The point si, you CANNOT use existing domain with BunnyCDN, you must use dedicated domain for the cdn, which require some tuning within the softare.

    I am not aware any other service or software that works like cloudflare. If this is one, then it's Great.

    Also I am assuming this come with DNS Server, right ?
    Also does it have API for purging the cache ?

    This script used ATS, take a look at https://trafficserver.apache.org/ for more details. The script basically works like CENTMINMOD console but similar to how you configure in bunny as basic levels. Between, ATS already have APIs out of the box.

    Anyway applaud for @dedipromo again on starting this piece. :)

    Thanked by 1dedipromo
  • @yokowasis said:

    mrclown said:

    @yokowasis said:
    Is this work like cloud flare where the cdn sit between the origin and automatically cache static resource, or some thing like bunnycdn?

    This is just installation script. ATS works like any other cache which is used by CF or bunny. Of cuz there'll be performance differences depending on what stack and how much optimization was made across their deployment.

    For simple setup, this script will help for beginners. In production setup, that needs to tune properly.

    Cloudflare and BunnyCDN, while they both CDN, work very differently.

    in Cloudflare you don't need to do anything. Just use their DNS service. in BunnyCDN, you need to change your software path to their domain or your custom domain. The point si, you CANNOT use existing domain with BunnyCDN, you must use dedicated domain for the cdn, which require some tuning within the softare.

    I am not aware any other service or software that works like cloudflare. If this is one, then it's Great.

    Also I am assuming this come with DNS Server, right ?
    Also does it have API for purging the cache ?

    Well, it does not come with DNS servers. You have to point your domain to these CDN IPs using A records. But yes, you can use your existing domain, and it will work just like cloudflare, without a fancy control panel though.

    It has very powerful API for purging caches if you read the ATS documentation, like @mrclown mentioned, but the script itself only comes with a purge-all option. I'll need to think about how to incorporate the feature.

    Thanked by 1JasonM
  • umiumi Member

    www.yourdomain.com CNAME your_subdomain.cdn_provider.domain.net let you use your domain on the CDN's edges.

    Thanked by 1JasonM
  • @dedipromo said:

    @doughnet said:
    I suggest an uninstall script.

    Also in the readme put a description of the commands. After installing I can't get back to the menu configuration list. There's no mention of ANY commands in the README.

    Thanks for the feedback. I'll update it tomorrow. Actually, running the script again will bring you to the menu.

    I'd recommend making the oneclickcdn.sh script be added as a native file to run. or else it's easy to delete if it's just another file floating around in the home directory.

  • @doughnet said:

    @dedipromo said:

    @doughnet said:
    I suggest an uninstall script.

    Also in the readme put a description of the commands. After installing I can't get back to the menu configuration list. There's no mention of ANY commands in the README.

    Thanks for the feedback. I'll update it tomorrow. Actually, running the script again will bring you to the menu.

    I'd recommend making the oneclickcdn.sh script be added as a native file to run. or else it's easy to delete if it's just another file floating around in the home directory.

    So store/execute it from /opt ;)

  • Wondering if this would (could be made to) work in a NAT environment.

  • sent a pull request so that it builds the server from github rather than having to update the link to the latest

  • @doughnet said: I suggest an uninstall script.

    This has been added.

    @doughnet said: Also in the readme put a description of the commands. After installing I can't get back to the menu configuration list. There's no mention of ANY commands in the README.

    This has been added.

    @doughnet said: I'd recommend making the oneclickcdn.sh script be added as a native file to run. or else it's easy to delete if it's just another file floating around in the home directory.

    This is an interesting point that I didn't even think of. I'll try to implement this in the next version.

    @AlwaysSkint said: Wondering if this would (could be made to) work in a NAT environment.

    As long as there is a reverse proxy instance (e.g. haproxy) in the host node, this should work. Performance might be somewhat lowered, but negligible. You'll also have to manually change the following line in /etc/trafficserver/records.config to match the port in your NAT server.

    CONFIG proxy.config.http.server_ports STRING 80 443:proto=http2;http:ssl
    

    One thing I'm worried about is that most NAT vps come with very small RAM and heavily throttled CPU. The compiling process might very likely get killed.

    @ginner159 said: sent a pull request so that it builds the server from github rather than having to update the link to the latest

    Thank you so much for the contribution, and I agree building from github is usually a more convenient way. The reason I chose not to build from github repo is because many Chinese users of this script are having a hard time accessing content from Github. Cloning content from github is unfortunately very unreliable in mainland China, due to GFW. Therefore, I can't really switch to Github source.

    Thanked by 1AlwaysSkint
  • Encourage contributions made by open source, but this may only apply to test, not a production environment.

    Thanked by 1dedipromo
  • This sounds and looks like a great project, I'm looking forward to checking it out more thoroughly when I have a little time.

    Thanks for creating and sharing.

    Thanked by 1dedipromo
  • sanvitsanvit Member

    @yokowasis said:
    The point si, you CANNOT use existing domain with BunnyCDN

    Actually, you can. Just set it to forward host header and set your origin as an IP address.

    Also I am assuming this come with DNS Server, right ?

    I don't think so

  • @umi said: I love Chinese people and don't like backdoors, especially when private keys are involved.

    What backdoors you found in scripts from China?

    it's open source so you can check by yourself, or the community will check it...
    I don't thinks this shell scripts is coded for those who don't know how to read it!

    Thanked by 2dedipromo tux
  • Will there be any backdoor feature in the future?

    Thanked by 1kkrajk
  • @sanvit said:

    @yokowasis said:
    The point si, you CANNOT use existing domain with BunnyCDN

    Actually, you can. Just set it to forward host header and set your origin as an IP address.

    Nice trick. Why I didn't think of this. I am assuming bunnycdn will honor the no cache request right? It would be terrible if it doesn't.

  • @gluetenberg said:
    Will there be any backdoor feature in the future?

    It does not have auto update, you can simply check the code before updating if there is a new release.

    Thanked by 3dedipromo tux kkrajk
  • jenokjenok Member, Host Rep

    @WebProject said: Based on your comments you can work for BBC TV.

    Headshot Of The Month !!

  • sanvitsanvit Member
    edited July 2020

    @yokowasis said:

    @sanvit said:

    @yokowasis said:
    The point si, you CANNOT use existing domain with BunnyCDN

    Actually, you can. Just set it to forward host header and set your origin as an IP address.

    Nice trick. Why I didn't think of this. I am assuming bunnycdn will honor the no cache request right? It would be terrible if it doesn't.

    Of course! I personally use it to speed up some dynamic sites, and BunnyCDN’s main site also seems to use this.

    This is actually better than Cloudflare for some cases, since CF routes free or pro users to farther locations for some, and Bunny’s page rule is awesome!

    BTW, there is an option called ‘forward host header’, or you can set the request header ‘Host’ to your domain with your domain using edge rules

    Thanked by 1kkrajk
  • This Is Awesome, Thanks.

  • I might be able to contribute to this with Trafficserver deb/rpm package. Not everyone have good amount of ram/cpu burst for long time not allowed by provider. Can LETers confirm if they would use this? I would provide packages if decent amount of users use this package.

  • LutungLutung Member
    edited December 2021
    Please specify the origin website IP address (e.g., 88.88.88.88).  If it has multiple IPs, any would work:
    xx.xx.xx.xx
    Is the origin website using HTTPS or HTTP?  Type 1 for HTTPS, or 2 for HTTP.  If both  
    works, then either is fine:
    
    **OneClickCDN.sh: line 536: [: =: unary operator expected**
    
    Adding mapping rules for abcde.com...
    2 rules added.
    

    got error message,

    OneClickCDN.sh: line 536: [: =: unary operator expected

  • root@hels:~/trafficserver-8.1.3# tail -f /usr/local/var/log/trafficserver/diags.log
    [Dec 24 14:59:38.521] traffic_server NOTE: Initial OCSP refresh started
    [Dec 24 14:59:38.521] traffic_server NOTE: Initial OCSP refresh finished
    [Dec 24 14:59:38.546] traffic_server WARNING: Unrecognized configuration value 'proxy.config.http.congestion_control.enabled'
    [Dec 24 14:59:38.550] [TS_MAIN] NOTE: traffic server running
    [Dec 24 14:59:38.577] [ET_NET 0] WARNING: disk header different for disk /usr/local/var/trafficserver/cache.db: clearing the disk
    [Dec 24 14:59:38.599] [ET_NET 0] NOTE: clearing cache directory '/usr/local/var/trafficserver/cache.db 16384:147456'
    [Dec 24 14:59:38.605] [ET_NET 0] NOTE: clearing cache directory '/usr/local/var/trafficserver/cache.db 1207975936:163840'
    [Dec 24 14:59:38.611] [ET_NET 0] NOTE: clearing cache directory '/usr/local/var/trafficserver/cache.db 2550153216:163840'
    [Dec 24 14:59:38.625] [ET_NET 0] NOTE: clearing cache directory '/usr/local/var/trafficserver/cache.db 3892330496:163840'
    [Dec 24 14:59:38.855] [ET_NET 0] NOTE: cache enabled
    

    Warning on diags.log

    [Dec 24 14:59:38.546] traffic_server WARNING: Unrecognized configuration value 'proxy.config.http.congestion_control.enabled'
    
  • I will definitely use this.

  • @Lutung said: got error message,

    OneClickCDN.sh: line 536: [: =: unary operator expected

    i used Debian 10, 64 bit, clean install, it just worked, no issues.

  • @painfreepc said:

    @Lutung said: got error message,

    OneClickCDN.sh: line 536: [: =: unary operator expected

    i used Debian 10, 64 bit, clean install, it just worked, no issues.

    I use

    root@hels:/home/debian# lsb_release -d
    Description: Debian GNU/Linux 10 (buster)

    not touched since I got free credit from lifehost360

    Will try make some VPS on proxmox and try again

  • @Lutung said: not touched since I got free credit from lifehost360

    may i ask what package and what is Integrated firewall?

  • LutungLutung Member
    edited December 2021

    @painfreepc said:

    @Lutung said: not touched since I got free credit from lifehost360

    may i ask what package and what is Integrated firewall?

    I think because of this

    echo "Is the origin website using HTTPS or HTTP?  Type 1 for HTTPS, or 2 for HTTP.  If 
    both works, then either is fine:"
        read isHTTPS
        if [ $isHTTPS = 1 ] ; then
            cdn_port=443
            config_mapping_cdn $cdn_hostname_add $origin_ip_add https 443
    

    And this is my mistake, not choose any.
    just hit enter because it was both work

  • painfreepcpainfreepc Member
    edited December 2021

    @Lutung said: And this is my mistake, not choose any.

    >

    a few trys for me also, that was my only issue

  • @WebProject said:

    @umi said:
    Huge script from China that needs sudo privilegies. I'll pass

    Very small script and open source without any odd code, see yourself:
    https://github.com/Har-Kuun/OneClickCDN/blob/master/OneClickCDN.sh

    ** Based on your comments you can work for BBC TV.**

    what do you mean by this statement exactly?

Sign In or Register to comment.