tryethernal / ethernal

Ethernal is a block explorer for EVM-based chains. In a few seconds, spin up a fully-featured explorer for your L1/L2 rollup/testnet. Compatible with Optimism, ZK, Anvil, Hardhat, Geth...
https://www.tryethernal.com
Other
204 stars 47 forks source link

ethernal in docker-compose #239

Closed lchg closed 1 year ago

lchg commented 1 year ago

I'm trying to run ethernal in docker-compose,but has some quesion [clone from develop branch]

1.the file /run/.env template is in .gitignore,so where to get the file

2.the file /.env.development is in .gitignore,so where to get the file

3.I read the doc in this link (https://doc.tryethernal.com/getting-started/self-hosted-installation), some env params i get from this

my env file data is .env AUTH_HOST=http://localhost:9099 FUNCTIONS_HOST=http://localhost:5001 RTDB_HOST=localhost:9000 FIRESTORE_HOST=localhost:8080

.env.development VUE_APP_FIREBASE_API_KEY=123 VUE_APP_FIREBASE_PROJECT_ID=ethernal-95a14 VUE_APP_AUTH_HOST=http://localhost:9099 VUE_APP_FIRESTORE_HOST=localhost:8080 VUE_APP_RTDB_HOST=localhost:9000 VUE_APP_FIREBASE_DATABASE_URL=http://localhost:9000/?ns=ethernal-95a14-default-rtdb VUE_APP_FUNCTIONS_HOST=http://localhost:5001 VUE_APP_API_ROOT_URL=http://localhost:8081 VUE_APP_ROOT_URL=http://localhost:8081 VUE_APP_ETHERSCAN_API_KEY=yoursetherscankey VUE_APP_STRIPE_PUBLIC_KEY=yourstripetestkey

when i run ./docker-compose up -d,it's run ok, but when i open in http://127.0.0.1:8080 is always loading

image image image

the ip 172.25.0.7 is container ip so,how to solve the cross-origin problem?

4.when i run NODE_ENV=development ethernal listen, it's return error [Missing email to authenticate. Make sure you've set ETHERNAL_EMAIL in your environment.], how to set to listen the local node and sync data to the ethernal local server.

antoinedc commented 1 year ago

Hey, so these doc was completely out of date. I just updated it. If you want to run locally you can skip the docker context setup part, and just follow https://doc.tryethernal.com/getting-started/self-hosted#web-app-setup and what's next. Let me know how it goes!

DegenComedian commented 1 year ago

Hi, I just followed https://doc.tryethernal.com/getting-started/self-hosted#web-app-setup, used the latest images but get the following CORS error:

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://app.app.avalanche-mainnet-browser.<reducted>/api/explorers?slug=app.avalanche-mainnet-browser. (Reason: CORS request did not succeed).

my config looks like:

APP_URL=app.avalanche-mainnet-browser.<reducted>
BASE_DOMAIN=app.avalanche-mainnet-browser.<reducted>
VUE_APP_MAIN_DOMAIN=app.avalanche-mainnet-browser.<reducted>

so there is something wrong with the double app.app. and the general CORS problem here.

The website loads but there is this spinning wheel which does not stop displaying because of the CORS error in the javascript console.

antoinedc commented 1 year ago

My bad, there shouldn't be an app prefix on VUE_APP_MAIN_DOMAIN, so only avalanche-mainnet-browser.<reducted>. I will update the doc.

antoinedc commented 1 year ago

Let me know if that fixes it

DegenComedian commented 1 year ago

the error is now gone, thank you for your quick response! Spinning wheel still hangs, my javascript console now brings the error:

GET https://app.avalanche-mainnet-browser.<reducted>/api/explorers?slug=app.avalanche-mainnet-browser
Status
400
Bad Request

VersionHTTP/2
Transferred331 B (24 B size)
Referrer Policystrict-origin-when-cross-origin
Content Security Policy: The page’s settings blocked the loading of a resource at inline (“script-src”).
Content Security Policy: The page’s settings observed the loading of a resource at inline (“script-src”). A CSP report is being sent.

btw, as for your documentation, I needed to set the following value to the redis container hostname in .env.prod (which is empty in your doc) because otherwise I get an error in the web container, that it can't connect to redis.

REDIS_HOST=redis
antoinedc commented 1 year ago

Ah thanks for the REDIS_HOST! Will update as well.

Well, turns out that this part Domains/URL variables can't be IPs and need to start with app., it can be app.example.com or app.subdomain.example.com, etc is actually wrong. The app won't work if it's on a sub-subdomain, it needs to be on a subdomain like app.mydomain.com. I will try to fix that this week. I'm updating the doc now, and will post an update here once it's fixed.

Or if you feel like doing a pull request to fix that, the code is in src/main.js line 23 to 30. It needs to check that if the host is app.VUE_APP_MAIN_DOMAIN, then do nothing, otherwise if it's somethingelse.VUE_APP_MAIN_DOMAIN call the store.dispatch function (line 29).

DegenComedian commented 1 year ago

i already fixed it locally and will create a pull request when I tested it sufficiently

antoinedc commented 1 year ago

Cool! Is everything running fine now?

DegenComedian commented 1 year ago

created a pull request, https://github.com/tryethernal/ethernal/pull/243 works for my setup both locally using /etc/hosts fake entries and also on a real server with multiple subdomains and SSL certificate.

antoinedc commented 1 year ago

Perfect!