scrapoxy icon indicating copy to clipboard operation
scrapoxy copied to clipboard

Digital Ocean API Change Breaking Pinger & Traffic

Open ibreakifix opened this issue 5 years ago β€’ 6 comments

Hello,

We noticed around 1PM today our Proxies for DigitalOcean started to fail to come online. Upon checking Scrapoxy, I noticed the control panel was reporting the local (private) IP address for all DO proxies. The pinger would then attempt to ping a private IP, which it obviously cannot reach, causing Scrapoxy to never properly see the online status of any DO instances.

Expected Behavior

Request is sent to digitalocean API to fetch a summary of all instance details. The Digital Ocean provider should then parse the API response and report the public IP to the Scrapoxy manager.

Actual Behavior

The API request is properly sent, but incorrectly parsed. The provider script is improperly hard-coded to recognize networks.v4[0].ip_address as the public ip address without checking the type. The causes the online status of DO instances to always be false. Digital Ocean began reporting private and public IPs, and the public IP was bumped to networks.v4[1].ip_address.

Fix

  1. Update the code to ensure the ip address type is public. Do this by changing /server/providers/digitalocean/index.js line 71 to: ip: _.get(_.find(_.get(droplet,'networks.v4'), _.matchesProperty('type', 'public')),'ip_address'),

Thanks

ibreakifix avatar Oct 02 '20 06:10 ibreakifix

I was going nuts trying to figure out why it wasn't working on DigitalOcean also. Proxies would start up then not register as alive even though they were running themselves. I'm surprised this fix hasn't been pushed into production for scrapoxy.

MegaManSE avatar Jan 05 '21 14:01 MegaManSE

Maybe I could use private to connect over DigitalOcean VPC so, would'n be better to have a type configuration?

{
    "commander": {
        "password": "****"
    },
    "instance": {
        "port": 3128,
        "scaling": {
            "min": 1,
            "max": 5
        }
    },
    "providers": [
        {
            "type": "digitalocean",
            "token": "your token",
            "region": "somewhere",
            "size": "s-1vcpu-1gb",
            "sshKeyName": "myKey",
            "imageName": "forward-proxy-for-the-win",
            "tags": "sometags",
            "ip_addr_type": "private"    // <=== could be private or public
        }
    ]
}
// and then on index
get ip_addr_type() {
        return this._config.ip_addr_type;
    }
get models() {
...

ip: _.get(_.find(_.get(droplet,'networks.v4'), _.matchesProperty('type', this.ip_addr_type)),'ip_address'),

clint74 avatar Jan 19 '21 14:01 clint74

Hello, Are you sure that update index.js line 71 is properly work? I still get checkalive =>false and droplets seems dead . Thanks

Tugrulvural89 avatar Feb 20 '21 13:02 Tugrulvural89

@Tugrulvural89 matching using in check-alive is strict, so double check that you are using the right case in values e.g. region to be lon1 instead of LON1

AhmedBytesBits avatar Mar 31 '21 19:03 AhmedBytesBits

This fix really helps us, thanks

adamcable avatar May 05 '21 14:05 adamcable

@Tugrulvural89 If you used "sudo npm install -g scrapoxy" and installed scrapoxy again in your local module, make sure you change the settings in the global node module. For reference: https://docs.npmjs.com/cli/v7/configuring-npm/folders

daniel-chum avatar Jun 19 '21 18:06 daniel-chum

it will be corrected in the 4.0.0 version

scrapoxy avatar Oct 04 '23 19:10 scrapoxy

Hey there! 🌟 Exciting news! Scrapoxy 4 is ready to rock πŸš€. Check it out at Scrapoxy.io (explore the "get started" guide, deployment documentation, and more πŸ“š). I can't wait to hear your feedback on this new version! Send me your coolest screenshots with as many proxies as possible! πŸ“ΈπŸ’» Join the Discord community if you have any questions or just want to chat. You can also open a GitHub issue for any bug or feature request 🐞✨. See you soon! 😎 Fabien

scrapoxy avatar Dec 12 '23 21:12 scrapoxy