At the moment, it is only possible to deploy Ethernal on https endpoint. If you deploy on a http endpoint, it will not work.
We'll deploy Ethernal remotely using Docker contexts. This assumes that the remote host has the following installed:
Docker
Node 16 & NPM
Docker context setup
On your local machine run:
export TARGET_HOST=1.1.1.1# Replace with the IP of your remote serverdockercontextcreateethernal--docker"host=ssh://${USER}@${TARGET_HOST}"ssh-copy-id $TARGET_HOSTssh-keyscan-H $TARGET_HOST >>~/.ssh/known_hostseval`ssh-agent-s`ssh-add
On the remote host, run:
sudochown $USER:docker/var/run/docker.sock
And on your local machine:
dockercontextuseethernaldockercontainerls# This should display an empty list
Now all your docker commands will execute remotely
Web app setup
Create a .prod.env file with the following content
Domains/URL variables can't be IPs and need to start with app.,app.yourdomain.com will be your admin access, explorers can be any other subdomains. app & explorers need to be at the same domain level (ie you can't have app.yourdomain.com & explorer.your.domain.com).
Because of some legacy code that will be eventually fixed, there are two different variables for POSTGRES credentials
REDIS_HOST=redis assumes you are connecting to Redis using the compose file with Docker internal networking. By default, there is no username/password
ENCRYPTION_KEY should be a 32 characters hex string, and ENCRYPTION_JWT_SECRET should be a 63 characters hex string
Firebase encryption system is used because of legacy as well, but there is no actual Firebase dependencies needed. The signer key needs to be a a base64 encoded string & the salt separator can be kept as show here
Pusher keys are all optional, if you set them, the explorer will refresh in real time.
If you'd like to use the reset password feature, you'll need to setup Sendgrid env variables, which is an api key & a sender email address. That's the only mail that the app would send, so you probably don't need it. However, please note that at this time, it's the only way to update a password.
SECRET can be any random string. It used to protect certain endpoint for access
Bullboard env variables are used to protect access to /bull, this page is the admin dashboard for the queuing package BullMQ
You can use the following script to automatically create a workspace + a public explorer linked to it.
You just need to replace constants at the beginning of the file, and run it with node.
Once it's created, start the CLI on this workspace, and blocks will start syncing.
constaxios=require('axios');constAPI_TOKEN='xxx';constAPI_ROOT='http://app.ethernal.com';constEXPLORER_SUBDOMAIN='ethernal.com '; // All explorers will be created under this subdomainconstEXPLORER_SLUG='test-explorer'; // This will be used for the subdomainconstWORKSPACE_NAME='Explorer';constRPC_SERVER='http://myRpcNode.com:8545';constNETWORK_ID=1337;constSECRET='xxx'; // Secret that you defined in your .env.prod fileconstTHEME= {"default":{}};// Customize branding using below values/*const THEME = { "light": { "primary": "#248aff", "success": "#00c9a7", "warning": "#db9a04", "error": "#de4437", "background": "#f5f8fc" }, "banner": "banner", "logo": "", // link to logo "font": "Questrial", // any google font "favicon": "", // link to favicon "links": [ { "name": "Website", "url": "https://example.com" }, { "icon": "mdi-twitter", // any icon on https://materialdesignicons.com/ "name": "Twitter", "url": "https://example.com" }, { "icon": "mdi-forum", "name": "Discord", "url": "https://example.com" } ]}*/constHEADERS= { headers: {'Authorization':`Bearer ${API_TOKEN}`,'Content-Type':'application/json' }}asyncfunctionmain() {try {constworkspacePayload= { name:WORKSPACE_NAME, workspaceData: { chain:'ethereum', networkId:NETWORK_ID, rpcServer:RPC_SERVER, public:true, tracing:'disabled' } }constworkspace= (awaitaxios.post(`${API_ROOT}/api/workspaces`, { data: workspacePayload },HEADERS)).data;constexplorerPayload= { workspaceId:workspace.id, name:WORKSPACE_NAME, rpcServer:RPC_SERVER, theme:THEME, token:'ether', domain:`${EXPLORER_SLUG}.${EXPLORER_SUBDOMAIN}`, slug:EXPLORER_SLUG, chainId:NETWORK_ID }constexplorer= (awaitaxios.post(`${API_ROOT}/api/explorers?secret=${SECRET}`, { data: explorerPayload },HEADERS)).data;console.log(`https://${explorer.domain}`); } catch(error) {console.log(error)console.log(`Error: ${error.response.data}`); }}main();
Web app updates
Every new release will push a Docker image here, tagged with latest as well as the version number.
You should subscribe to releases here, and decide based on the changelog if you want to upgrade or not.
If you want to, update the docker-compose.prod.yml file by replacing the latest tag with the version you'd like to upgrade to, for web & the workers, and run the following commands: