liquidnft / lnft

Liquid NFT Platform
GNU Affero General Public License v3.0
56 stars 23 forks source link

Failing: Setup local development environment #36

Closed damanic closed 3 years ago

damanic commented 3 years ago

From windoze power shell

git clone https://github.com/liquidnft/lnft
cd lnft
yarn
cd hasura
cp .env.sample .env
cd app
yarn
cd ..
docker run -it -v ${PWD}/app:/app --entrypoint yarn asoltys/lnft-server
docker-compose up -d
hasura migrate apply

All steps complete OK until hasura migrate apply fails with a table does not exist error:

WARN [cli: v2.0.9] [server: v1.3.3] version mismatch: cli and server does not match
time="2021-09-12T10:56:30+10:00" level=fatal msg="{\n  \"internal\": {\n    \"statement\": \"\\n                SELECT table_schema, table_name, is_enum, configuration::json\\n                FROM hdb_catalog.hdb_table\\n                 WHERE is_system_defined = 'f
alse'\\n                ORDER BY table_schema ASC, table_name ASC\\n                    \",\n    \"prepared\": false,\n    \"error\": {\n      \"exec_status\": \"FatalError\",\n      \"hint\": null,\n      \"message\": \"relation \\\"hdb_catalog.hdb_table\\\" does n
ot exist\",\n      \"status_code\": \"42P01\",\n      \"description\": null\n    },\n    \"arguments\": []\n  },\n  \"path\": \"$.args\",\n  \"error\": \"database query error\",\n  \"code\": \"unexpected\"\n}"

What am I missing?

zynos commented 3 years ago

I have the same problem at the step.

 hasura migrate apply
WARN [cli: v2.0.6] [server: v1.3.3] version mismatch: cli and server does not match 
FATA[0000] apply failed
{
  "internal": {
    "statement": "DROP TABLE \"public\".\"files\";\n",
    "prepared": false,
    "error": {
      "exec_status": "FatalError",
      "hint": null,
      "message": "table \"files\" does not exist",
      "status_code": "42P01",
      "description": null
    },
    "arguments": []
  },
  "path": "$.args",
  "error": "query execution failed",
  "code": "postgres-error"
} 

I am on ubuntu 20.04 .

asoltys commented 3 years ago

Should be fixed by https://github.com/liquidnft/lnft/commit/54cb607a84e1e6b2ebd8351b3956edc98f8e23c5

zynos commented 3 years ago

Now it's one step closer to working but it still fails at hasura migrate apply

✔ default
FATA[0004] apply failed
{
  "internal": {
    "statement": "CREATE OR REPLACE VIEW \"public\".\"recentactivity\" AS \n SELECT t1.id,\n    t1.artist_id,\n    t1.title,\n    t1.owner_id,\n    t1.description,\n    t1.filename,\n    t1.created_at,\n    t1.list_price,\n    t1.transferred_at,\n    t1.asset,\n    t1.auction_end,\n    t1.list_price_tx,\n    t1.asking_asset,\n    t1.auction_start,\n    t1.editions,\n    t1.reserve_price,\n    t1.ticker,\n    t1.royalty,\n    t1.max_extensions,\n    t1.extension_interval,\n    t1.bid_increment,\n    t1.filetype,\n    t1.views,\n    t1.edition,\n    t1.slug,\n    t1.auction_release_tx,\n    t1.is_physical,\n    t1.instagram\n   FROM (artworks t1\n     JOIN ( SELECT transactions.artwork_id,\n            max(transactions.created_at) AS max_created_at\n           FROM transactions\n           WHERE type != 'receipt'\n          GROUP BY transactions.artwork_id) t2 ON (((t1.id = t2.artwork_id) AND (t1.created_at = t2.max_created_at))))\n  ORDER BY t1.created_at DESC;\n",
    "prepared": false,
    "error": {
      "exec_status": "FatalError",
      "hint": null,
      "message": "column t1.views does not exist",
      "status_code": "42703",
      "description": null
    },
    "arguments": []
  },
  "path": "$",
  "error": "query execution failed",
  "code": "postgres-error"
} 
Eskyee commented 3 years ago

it works fine for me, after working it out my local bugs.. like yourself, I found it was the Dependency mismatch on my docker containers was my problems local. my deployment is working fine too.

so make sure your docker is running hasura/graphql-engine:v2.0.9.cli-migrations-v3 nhost/hasura-backend-plus:v2.2.3

hasura migrate apply it should work fine.. after this @zynos

im using a Mac and visual studio code for my local dev

hope to get a rough dev workflow guide going, once I can understand stack fully. and some database basics..

zynos commented 3 years ago

I updated hasura from 2.0.6 to 2.0.9 but i still get the same "column t1.views does not exist" error, as mentioned above.

When I execute the first yarn i get this info:

yarn install v1.22.11
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents@2.1.3: The platform "linux" is incompatible with this module.
info "fsevents@2.1.3" is an optional dependency and failed compatibility check. Excluding it from installation.
info fsevents@2.3.2: The platform "linux" is incompatible with this module.
info "fsevents@2.3.2" is an optional dependency and failed compatibility check. Excluding it from installation.
info fsevents@2.3.1: The platform "linux" is incompatible with this module.
info "fsevents@2.3.1" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
Done in 6.99s.

Could that be a problem?

Eskyee commented 3 years ago

I don't think so, as I saw that same problem When I executed the first yarn on my Mac vscode

" info fsevents@2.1.3: The platform "linux" is incompatible with this module. info "fsevents@2.1.3" is an optional dependency and failed compatibility check. Excluding it from installation. info fsevents@2.3.2: The platform "linux" is incompatible with this module. info "fsevents@2.3.2" is an optional dependency and failed compatibility check. Excluding it from installation. info fsevents@2.3.1: The platform "linux" is incompatible with this module. info "fsevents@2.3.1" is an optional dependency and failed compatibility check. Excluding it from installation. [3/4] Linking dependencies... [4/4] Building fresh packages... Done in 6.99s."

on my end.

I'm sure @asoltys can explain some more details,

zynos commented 3 years ago

When i continue with all the other steps i get some more errors, but at the end i can load the webpage under "http://localhost:3000/" sucessfully. I get the message field "artworks" not found in type: 'query_root' at the top right of the page. maybe it is related to the database problem. In addition when i create a new user and log in with the new credentials i get logged out automatically.

Eskyee commented 3 years ago

Can confirm field "artworks_aggregate" not found in type: 'query_root' happens when not logged in.. @asoltys

Also can u Check to see IF all your docker containers are running... @zynos

zynos commented 3 years ago

These containers are running, is one missing?

CONTAINER ID   IMAGE                                            COMMAND                  CREATED       STATUS                        PORTS                                                                                                                                                                                    NAMES
ce67f930a6fb   asoltys/lnft-server                              "docker-entrypoint.s…"   2 hours ago   Up 25 seconds                 0.0.0.0:8091->8091/tcp, :::8091->8091/tcp                                                                                                                                                lapp
70feaac67643   nhost/hasura-backend-plus:v2.2.3                 "docker-entrypoint.s…"   2 hours ago   Up About a minute (healthy)   0.0.0.0:3400->3000/tcp, :::3400->3000/tcp                                                                                                                                                hbp
a9f42dd24f6d   hasura/graphql-engine:v2.0.9.cli-migrations-v3   "docker-entrypoint.s…"   2 hours ago   Up 2 minutes                  0.0.0.0:8080->8080/tcp, :::8080->8080/tcp                                                                                                                                                hasura
337b9380f81d   vulpemventures/electrs-liquid:latest             "/build/electrs -vvv…"   2 hours ago   Up 2 minutes                  0.0.0.0:60401->60401/tcp, :::60401->60401/tcp, 0.0.0.0:3012->3002/tcp, :::3012->3002/tcp                                                                                                 electrs-liquid
c17af8deef44   asoltys/liquid:latest                            "elementsd -datadir=…"   2 hours ago   Up 2 minutes                  0.0.0.0:18606->18602/tcp, :::18606->18602/tcp, 0.0.0.0:18607->18603/tcp, :::18607->18603/tcp, 0.0.0.0:7045->18884/tcp, :::7045->18884/tcp, 0.0.0.0:7044->18886/tcp, :::7044->18886/tcp   liquid
ddba6305c084   postgres:12                                      "docker-entrypoint.s…"   2 hours ago   Up 2 minutes                  0.0.0.0:5433->5432/tcp, :::5433->5432/tcp                                                                                                                                                postgres
83cfaa1fbf67   ipfs/go-ipfs                                     "/sbin/tini -- /usr/…"   2 hours ago   Up About a minute             0.0.0.0:4001->4001/tcp, :::4001->4001/tcp, 4001/udp, 0.0.0.0:5001->5001/tcp, :::5001->5001/tcp, 8081/tcp, 0.0.0.0:8081->8080/tcp, :::8081->8080/tcp                                      ipfs
8603c72d007c   vulpemventures/esplora:latest                    "docker-entrypoint.s…"   2 hours ago   Up 2 minutes                  0.0.0.0:5005->5000/tcp, :::5005->5000/tcp                                                                                                                                                esplora-liquid
Eskyee commented 3 years ago

Containers Looks good to me...

Currently it all works for me.. I use Mac & vscode.

What is your local system!! windows or Mac.. ??

Eskyee commented 3 years ago

Because if windows I can't help yah !! 😂

zynos commented 3 years ago

I am using the Linux distribution Ubuntu 20.04

Eskyee commented 3 years ago

You can Try using Developer Tools in your browser, as will help tracking down your problems.. send browser errors for debugging.

Also logs from your docker files will help @asoltys figure out the problem..

You can also hunt down the error yourself this way.

zynos commented 3 years ago

Yes i was also checking the brwoser logs but i could not figure out too much from that: <Login> received an unexpected slot "default". <Routes> received an unexpected slot "default".

instance/<@http://localhost:3000/_app/routes/index.js:916:74
async*run@http://localhost:3000/web_modules/svelte/internal.js:18:12
mount_component/<@http://localhost:3000/web_modules/svelte/internal.js:1416:45
flush@http://localhost:3000/web_modules/svelte/internal.js:746:17
promise callback*schedule_update@http://localhost:3000/web_modules/svelte/internal.js:707:26
make_dirty@http://localhost:3000/web_modules/svelte/internal.js:1444:9
init/$$.ctx<@http://localhost:3000/web_modules/svelte/internal.js:1480:31
instance/$$self.$$set@http://localhost:3000/_app/assets/generated/root.js:540:38
relayInternalMethods/</get/<@http://localhost:3000/web_modules/svelte-hmr/runtime/hot-api-esm.js:297:28
$set@http://localhost:3000/web_modules/svelte/internal.js:1573:18
relayCalls/dest[key]@http://localhost:3000/web_modules/svelte-hmr/runtime/hot-api-esm.js:260:41
render@http://localhost:3000/_app/assets/runtime/internal/start.js:339:14
async*navigate@http://localhost:3000/_app/assets/runtime/internal/start.js:181:23
goto@http://localhost:3000/_app/assets/runtime/internal/start.js:166:16
goto@http://localhost:3000/_app/assets/runtime/app/navigation.js:5:16
goto@http://localhost:3000/_app/lib/utils.js:120:13
login/<@http://localhost:3000/_app/lib/auth.js:103:11
resolver/bodyParser/</<@http://localhost:3000/web_modules/wretch.js:199:122
promise callback*resolver/bodyParser/<@http://localhost:3000/web_modules/wretch.js:199:90
login@http://localhost:3000/_app/lib/auth.js:97:6
submit_handler@http://localhost:3000/_app/routes/login/index.js:489:36
prevent_default/<@http://localhost:3000/web_modules/svelte/internal.js:245:19
Eskyee commented 3 years ago

that's Kool that's your nhost/hasura-backend-plus:v2.2.3. trying to connect that will help @asoltys to track it down..

Butt you might need to double check all your configs are set correct. .env etc etc,

zynos commented 3 years ago

I found another error in the browser console:

Uncaught (in promise) TypeError: (intermediate value).data is undefined
    instance http://localhost:3000/_components/Session.js:60

It points to this funtion in Session.js

    onMount(async () => {
        if ($token) {
            set_store_value(user, $user = (await hasura.auth(`Bearer ${$token}`).post({ query: getUser }).json()).data.currentuser[0], $user);
            if (!$user.wallet_initialized) goto("/wallet/setup");
        }
    });
zynos commented 3 years ago

@Eskyee how can i detect wheter my .env config is incorrect?

Eskyee commented 3 years ago

Some of the errors will go away once your logged in,

.etc Check raretoshi master branch the .etc sample ..

Then set up for your install..

zynos commented 3 years ago

I could solve the hasura migrate problem and create a user succesfully :) I deleted the line t1.viewsfrom hasura/migrations/default/1616714901613_run_sql_migration/up.sql: Afterwards i ran these lines:

hasura migrate apply
hasura metadata apply
hasura seeds apply

and there was only a complaint about metadata being inconsistent