Skip to content
This repository has been archived by the owner on Oct 20, 2023. It is now read-only.

Waiting for daemons to come online #362

Closed
GregorWedlich opened this issue Jun 15, 2018 · 20 comments
Closed

Waiting for daemons to come online #362

GregorWedlich opened this issue Jun 15, 2018 · 20 comments
Labels

Comments

@GregorWedlich
Copy link

Hello,

Maybe an idea?

Miningcore log says:

[2018-06-14 20:23:32.5273] [I] [dash1] [Pool] Launching ... 
[2018-06-14 20:23:32.5415] [I] [dash1] [Bitcoin Job Manager] Launching ... 
[2018-06-14 20:23:32.6067] [E] [PayoutManager] [dash1] Payment processing failed System.Net.Sockets.SocketException (111): Connection refused
at Npgsql.NpgsqlConnector.Connect(NpgsqlTimeout timeout)
at Npgsql.NpgsqlConnector.RawOpen(NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken)
at Npgsql.NpgsqlConnector.Open(NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken)

and

[2018-06-14 14:18:19.0099] [I] [dash1] [Bitcoin Job Manager] Waiting for daemons to come online ...

My Setup:

deamon start:
./dash-cli -conf=/home/.dashcore/dash.conf -datadir=/home/.dashcore/

deamon conf:

rpcuser=xxx
rpcpassword=xxx
rpcallowip=127.0.0.1
listen=1
server=1
daemon=1
maxconnections=64

Miningcore Start:
docker run -d -p 3062:3062 -v /home/miningcore/dash_pool.json:/config.json:ro coinfoundry/miningcore-docker

Version:

Postgresql 9.6.7
Docker version 17.12.0-ce, build c97c6d6
.NET Core 4.6.26515.07 on Linux 4.9.0-4-amd64 #1 SMP Debian 4.9.51-1 (2017-09-28) [X64]
Miningcore Release 24

Thanks in advanced.

@21void
Copy link
Contributor

21void commented Jun 20, 2018

you need to allow docker ip to connect to coin daemon
for example, (yours may be different)
rpcallowip=172.32.*

@GregorWedlich
Copy link
Author

@21void mhh i have :(

@21void
Copy link
Contributor

21void commented Jun 20, 2018

and what ip do you use to connect to coin daemon? don't tell me it is 127.0.0.1 :)
make sure you use docker host hostname/ip instead. best way to troubleshoot is to test rpc call to coin daemon using curl inside container

@GregorWedlich
Copy link
Author

Thanks for the tip with the "curl"....

I change in config.json the ip for deamon to public ip from my host. And now its runs.

@GregorWedlich
Copy link
Author

@21void How can I access the API Ip from outside?

@calvintam236
Copy link
Contributor

@montymotz if you want to access from outside, you need to publish port at docker, port forwarding at your router.

@GregorWedlich
Copy link
Author

@calvintam236 No. The Docker runs on a Dedicated Server with Public IP.

@calvintam236
Copy link
Contributor

@montymotz What port did you set API on? Did you add -p PORT:PORT in the docker run command?

@GregorWedlich
Copy link
Author

GregorWedlich commented Jun 20, 2018

@calvintam236

docker run -v /home/miningcore:/miningcore -d --name calvin_miningcore -p 3062:3062 -p 4000:4000 calvintam236/miningcore:x86_64 -c /miningcore/config.json

and ccminer says:

Stratum connection failed: Failed to connect to x.x.x.x port 3062: Connection refused

@calvintam236
Copy link
Contributor

@montymotz this command should work, and if you still have problems, something is not right at config.json.

@GregorWedlich
Copy link
Author

@calvintam236 in config is the listen ip 0.0.0.0. That should be right?

curls says:

curl 172.17.0.6 curl: (7) Failed to connect to 172.17.0.6 port 80: Connection refused

@calvintam236
Copy link
Contributor

@montymotz It is correct for 0.0.0.0. You should test on port 4000, not 80 per your setting.

@GregorWedlich
Copy link
Author

@calvintam236 on port 4000 the same problem.

sudo iptables -t nat -L -n
Chain PREROUTING (policy ACCEPT)
target     prot opt source               destination
DOCKER     all  --  0.0.0.0/0            0.0.0.0/0            ADDRTYPE match dst-type LOCAL

Chain INPUT (policy ACCEPT)
target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination
DOCKER     all  --  0.0.0.0/0           !127.0.0.0/8          ADDRTYPE match dst-type LOCAL

Chain POSTROUTING (policy ACCEPT)
target     prot opt source               destination
MASQUERADE  all  --  172.20.0.0/16        0.0.0.0/0
MASQUERADE  all  --  172.19.0.0/16        0.0.0.0/0
MASQUERADE  all  --  172.18.0.0/16        0.0.0.0/0
MASQUERADE  all  --  172.17.0.0/16        0.0.0.0/0
MASQUERADE  tcp  --  172.17.0.3           172.17.0.3           tcp dpt:80
MASQUERADE  tcp  --  172.17.0.4           172.17.0.4           tcp dpt:80
MASQUERADE  tcp  --  172.17.0.4           172.17.0.4           tcp dpt:22
MASQUERADE  tcp  --  172.17.0.5           172.17.0.5           tcp dpt:9000
MASQUERADE  tcp  --  172.17.0.6           172.17.0.6           tcp dpt:4000
MASQUERADE  tcp  --  172.17.0.6           172.17.0.6           tcp dpt:3062

Chain DOCKER (2 references)
target     prot opt source               destination
RETURN     all  --  0.0.0.0/0            0.0.0.0/0
RETURN     all  --  0.0.0.0/0            0.0.0.0/0
RETURN     all  --  0.0.0.0/0            0.0.0.0/0
RETURN     all  --  0.0.0.0/0            0.0.0.0/0
DNAT       tcp  --  0.0.0.0/0            127.0.0.1            tcp dpt:32768 to:172.17.0.3:80
DNAT       tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:8929 to:172.17.0.4:80
DNAT       tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:2289 to:172.17.0.4:22
DNAT       tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:9050 to:172.17.0.5:9000
DNAT       tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:4000 to:172.17.0.6:4000
DNAT       tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:3062 to:172.17.0.6:3062

@calvintam236
Copy link
Contributor

@montymotz Please attach docker ps -a console output and your config.json. Please also go to canyouseeme.org and test port 4000 on the server.

@GregorWedlich
Copy link
Author

GregorWedlich commented Jun 20, 2018

@calvintam236

$ docker ps -a
CONTAINER ID        IMAGE                            COMMAND                  CREATED             STATUS                                                                 PORTS                                                 NAMES
6b9ee5d1ae19        calvintam236/miningcore:x86_64   "dotnet /usr/local/m…"   4 minutes ago       Up 4 minutes                                                           0.0.0.0:3062->3062/tcp, 0.0.0.0:4000->80/tcp          calvin_miningcore
2a2becaefc26        coinfoundry/miningcore-docker    "/bin/sh -c 'dotnet …"   4 days ago          Exited (137) 7 h                                            ours ago                                                         dash-deamon
ef516df7bb85        portainer/portainer              "/portainer"             7 days ago          Up 7 days                                                              0.0.0.0:9050->9000/tcp                                cranky_euler
f14ff9dd6bcd        d288120f70c0                     "/assets/wrapper"        5 months ago        Up 5 months (hea                                            lthy)      443/tcp, 0.0.0.0:2289->22/tcp, 0.0.0.0:8929->80/tcp   gitlab
0b38174704f0        nextcloud:12-apache              "/entrypoint.sh apac…"   5 months ago        Up 5 months                                                            127.0.0.1:32768->80/tcp                               nextcloud
d3e93a3725ff        postgres:10.1-alpine             "docker-entrypoint.s…"   5 months ago        Up 5 months                                                            5432/tcp                                              postgres

config.json:

{
    "logging": {
        "level": "info",
        "enableConsoleLog": true,
        "enableConsoleColors": true,
        "logFile": "",
        "logBaseDirectory": "",
        "perPoolLogFile": false
    },
    "banning": {
        "manager": "integrated",
        "banOnJunkReceive": true,
        "banOnInvalidShares": false
    },
    "notifications": {
        "enabled": true,
        "email": {
            "host": "smtp.example.com",
            "port": 587,
            "user": "user",
            "password": "password",
            "fromAddress": "info@yourpool.org",
            "fromName": "support"
        },
        "admin": {
            "enabled": false,
            "emailAddress": "user@example.com",
            "notifyBlockFound": true
        }
    },
    "persistence": {
        "postgres": {
            "host": "148.x.x.x", <- My Public IP
            "port": 5432,
            "user": "xxxx",
            "password": "xxxx",
            "database": "miningcore"
        }
    },
    "paymentProcessing": {
        "enabled": true,
        "interval": 600,
        "shareRecoveryFile": "recovered-shares.txt"
    },
    "pools": [{
        "id": "dash1",
        "enabled": true,
        "coin": {
            "type": "DASH"
        },
        "address": "xxxxx",
        "rewardRecipients": [{
            "address": "xxxx",
            "percentage": 0
        }],
        "blockRefreshInterval": 500,
        "jobRebroadcastTimeout": 10,
        "clientConnectionTimeout": 600,
 "banning": {
            "enabled": true,
            "time": 600,
            "invalidPercent": 50,
            "checkThreshold": 50
        },
        "ports": {
            "3062": {
                "listenAddress": "0.0.0.0",
                "difficulty": 1024,
                "name": "ASIC Mining",
                "varDiff": {
                    "minDiff": 512,
                    "targetTime": 15,
                    "retargetTime": 90,
                    "variancePercent": 30
                }
            }
        },
        "daemons": [{
            "host": "148.x.x.x", <- Public IP from my Host
            "port": 9998,
            "user": "xxxx",
            "password": "xxxx"
        }],
        "paymentProcessing": {
            "enabled": true,
            "minimumPayment": 0.5,
            "payoutScheme": "PPLNS",
            "payoutSchemeConfig": {
                "factor": 2.0
            }
        }
    }]
}

Port 4000 is close. Why my Dedicated Web Server behind an Nginx. But I can not even access the container from the server.

@calvintam236
Copy link
Contributor

@montymotz Your API is disabled per your config.json. Check here for config doc.

@GregorWedlich
Copy link
Author

@calvintam236 Shame on me, that's it. Many thanks to all!

@21void
Copy link
Contributor

21void commented Jun 23, 2018

@montymotz this is a bit off topic but...

"host": "148.x.x.x", <- Public IP from my Host

i would not recommend you listen coin rpc on public IP unless you know what you are doing.

@GregorWedlich
Copy link
Author

@21void Yes, my docker image could not connect to the local host ip. The Public IP was an test. I fix this with the docker run command "--network host".

docker run --network host ....

Thanks anyway.

@GregorWedlich
Copy link
Author

Security:

--net=host -- Tells Docker to skip placing the container inside of a separate network stack. In essence, this choice tells Docker to not containerize the container's networking! While container processes will still be confined to their own filesystem and process list and resource limits, a quick ip addr command will show you that, network-wise, they live “outside” in the main Docker host and have full access to its network interfaces. Note that this does not let the container reconfigure the host network stack — that would require --privileged=true — but it does let container processes open low-numbered ports like any other root process. It also allows the container to access local network services like D-bus. This can lead to processes in the container being able to do unexpected things like restart your computer. You should use this option with caution.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants