interledger-deprecated / ilp-kit

Everything needed to create a ledger and connect it to the Interledger
https://interledgerjs.github.io/ilp-kit/apidoc/
74 stars 39 forks source link

ilpkit constantly fails #188

Closed blackwasp76 closed 7 years ago

blackwasp76 commented 7 years ago

I have went through the setup twice in a two different droplets and both times I run into this error, has anyone encounter this and know the fix for it. I'm new to this and not sure if this is the place to put this, if it isn't my apologies, I'm just looking to get my ledger up and running. Any help would be appreciated.

[api] 2017-01-31T04:17:52.841Z sequelize DEBUG Executing (default): SELECT "id", "hostname", "limit", "currency", "created_at", "updated_at" FROM "Peers" AS "Peer"; [api] (node:3085) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): Error: Unable to connect to account [api] 2017-01-31T04:17:53.586Z connector:app error Error: Unable to connect to account

sharafian commented 7 years ago

Could you put in more of your logs? It looks like something is trying to connect to an account that doesn't exist, but it's hard to tell why that's happening without seeing what else is happening

blackwasp76 commented 7 years ago

Here is more of the logs

[api] 2017-01-31T12:34:24.151Z http INFO <-- GET /auth/load [api] 2017-01-31T12:34:24.160Z error-handler WARN Not Found: No active user session [api] 2017-01-31T12:34:24.166Z http INFO --> GET /auth/load 404 16ms - [api] 2017-01-31T12:34:24.244Z http INFO <-- GET /config [api] 2017-01-31T12:34:24.247Z ledger INFO getting ledger info http://localhost:3101 [ledger] 2017-01-31T12:34:24.252Z ledger:koa info <-- GET / [ledger] 2017-01-31T12:34:24.258Z ledger:koa info --> GET / 200 7ms 916B [api] 2017-01-31T12:34:24.260Z connector INFO Starting the connector... [api] 2017-01-31T12:34:24.271Z http INFO --> GET /config 200 27ms - [api] 2017-01-31T12:34:24.295Z sequelize DEBUG Executing (default): SELECT "id", "hostname", "limit", "currency", "created_at", "updated_at" FROM "Peers" AS "Peer"; [api] (node:5039) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): Error: Unable to connect to account [api] 2017-01-31T12:34:25.176Z connector:app error Error: Unable to connect to account [api] at requestRetry (/home/user/ilp-kit/node_modules/ilp-plugin-bells/src/lib/plugin.js:83:9) [api] at next (native) [api] at onFulfilled (/home/user/ilp-kit/node_modules/co/index.js:65:19) [api] at process._tickCallback (internal/process/next_tick.js:103:7)

sharafian commented 7 years ago

What hostname did you put for your ILP Kit? Can you connect to the domain and make sure that the ledger endpoints actually work? (https://yourilpkit.example/ledger should return a JSON object with the ledger metadata, for example).

It looks like the API fetches the metadata via a local URL (http://localhost:3101), but when it tries to connect to an account (which is done via the public hostname), it seems to fail.

That's just my guess though. If it isn't an issue with the hostname, can you paste in your env.list (with passwords obscured, of course)?

blackwasp76 commented 7 years ago

When I try this ("https://yourilpkit.example/ledger") I get the 404 error. Below is the env.list

DB_URI=postgres://USER:PASSWORD@localhost/ilpkit API_EMAIL_SENDER_NAME=domain API_EMAIL_SENDER_ADDRESS=ilpkit@url.com API_GITHUB_CLIENT_ID= API_GITHUB_CLIENT_SECRET= API_HOSTNAME=domain.com API_MAILGUN_API_KEY= API_MAILGUN_DOMAIN= API_PORT=3100 API_PRIVATE_HOSTNAME=localhost API_PUBLIC_HTTPS=true API_PUBLIC_PATH=/api API_PUBLIC_PORT=443 API_SECRET=SECRET BLUEBIRD_WARNINGS=0 CLIENT_HOST=domain.com CLIENT_PORT=3010 CLIENT_PUBLIC_PORT=443 CLIENT_TITLE=domain LEDGER_ADMIN_USER=admin LEDGER_ADMIN_PASS=PASSWORD LEDGER_CURRENCY_CODE=USD LEDGER_CURRENCY_SYMBOL=$ LEDGER_ILP_PREFIX=us.usd.domain. LEDGER_PRECISION=10 CONNECTOR_ENABLE=true CONNECTOR_LEDGERS={"us.usd.domain.":{"currency":"USD","plugin":"ilp-plugin-bells","options":{"account":"https://domain.com/ledge$ CONNECTOR_LOG_LEVEL=info CONNECTOR_MAX_HOLD_TIME=100 CONNECTOR_AUTOLOAD_PEERS=true CONNECTOR_PORT=4000 LEDGER_RECOMMENDED_CONNECTORS=user ILP_KIT_CLI_VERSION=11.0.1

_CONNECTORS=user ILP_KIT_CLI_VERSION=11.0.1

sharafian commented 7 years ago

Sorry for not being clear, I meant that if you query your own domain, it should get the ledger metadata, which in this case would be https://180dcgroupllc.com/ledger. Also, it looks like your CONNECTOR_LEDGERS variable got cut off when you pasted it, so I don't know if there could be an error in that line.

Everything else in the file seems to check out, though. If https://180dcgroupllc.com/ledger gives you a 404 error, then it's most likely a problem with your domain setup or your nginx configuration. You could try going over the nginx setup steps of the SETUP.md again, and making sure that the proper IP address is listed in your domain's control panel.

blackwasp76 commented 7 years ago

yes, when I do nano it cuts that one line off, but when I do vi it shows it, here it is below. CONNECTOR_LEDGERS={"us.usd.domain.":{"currency":"USD","plugin":"ilp-plugin-bells","options":{"account":"https://domain.com/ledger/accounts/ACCOUNTNAME","username":"user","password":"password"}}}

It's also funny you say that about nginx, cause I actually had a question regarding that, I'm not sure I made the changes correctly in this file /etc/nginx/sites-available/default, could you verify this for me below server { listen 80 default_server; listen [::]:80 default_server; server_name domain.com www.domain.com; return 301 https://$server_name$request_uri;

    location ~ /.well-known{
            allow all;
            }

    root /var/www/html;
    location ~ /.well-known{
            allow all;
            }

    root /var/www/html;

    # Add index.php to the list if you are using PHP
    index index.html index.htm index.nginx-debian.html;

    server_name _;

    # point the root to the ILP Kit UI
    location / {
            proxy_pass http://localhost:3010;

            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
    }

    # allow webfinger and letsencrypt to coexist

  server_name _;

    # point the root to the ILP Kit UI
    location / {
            proxy_pass http://localhost:3010;

            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
    }

    # allow webfinger and letsencrypt to coexist
    location ~ /.well-known/webfinger {
            proxy_pass http://localhost:3010;
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
    }

}

    server{
    # SSL configuration
    #
    listen 443 ssl http2 default_server;
    listen [::]:443 ssl http2 default_server;
    include snippets/ssl-domain.com.conf;
    include snippets/ssl-params.conf;
    }
sharafian commented 7 years ago

Your server block with the redirect on port 80 should be a self-contained block, like so:

server {
        listen 80 default_server;
        listen [::]:80 default_server;
        server_name 180dcgroupllc.com www.180dcgroupllc.com;
        return 301 https://$server_name$request_uri;
}

The other contents that you added into that server block should go into the second server block, the one listening on port 443. You've also got a duplicated location / block. So your second server block should look like:

server {
        # SSL configuration

        listen 443 ssl http2 default_server;
        listen [::]:443 ssl http2 default_server;
        include snippets/ssl-180dcgroupllc.com.conf;
        include snippets/ssl-params.conf;

        root /var/www/html;

        # Add index.php to the list if you are using PHP
        index index.html index.htm index.nginx-debian.html;

        server_name _;

        # point the root to the ILP Kit UI
        location / {
                proxy_pass http://localhost:3010;

                proxy_http_version 1.1;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection "upgrade";
        }

        # allow webfinger and letsencrypt to coexist
        location ~ /.well-known/webfinger {
                proxy_pass http://localhost:3010;

                proxy_http_version 1.1;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection "upgrade";
        }

        # Make the well-known file accessible to obtain a letsencrypt certificate
        location ~ /.well-known {
                allow all;
        }
}

Another thing to make sure is that this is the actual enabled configuration on your site. Make sure that /etc/nginx/sites-enabled/default has the right configuration in it.

Hope this helps!

blackwasp76 commented 7 years ago

This helps immensely and I appreciate it all. The setup doc is also really good and I'm really thankful for all the work everyones done to bring this together. Also would you mind replacing the actual domain name with domain in your comment and I will close this issue.

blackwasp76 commented 7 years ago

I took your configuration and it works, I now see the metadata on the domain.com/ledger page and I have no errors with the ilpkit running. There is only one thing left as it seems. When I go to domain.com:3010, it fails with took too long to respond. Should there be a UI for me to login to there or am I missing something still within in my nginx config I need to investigate?

sharafian commented 7 years ago

Awesome, I'm glad that everything is working. Port 3010 isn't being exposed to the internet, which is why you can't connect to it through your browser. There shouldn't be any need to connect to it though, because nginx proxies 3010 to 443, which will load when you go to https://180dcgroupllc.com

blackwasp76 commented 7 years ago

Got it and now it seems to be working, thank you