npm

Inspired by Micah P. Dombrowski's Node.js Environment.

apt update
sudo apt-get install libsecret-1-dev pass gnupg2 dbus default-dbus-session-bus dbus-x11 pass gnupg2 gnome-keyring
33.8s
nodejs (Bash)
FILENAME="node-v${NODEJS_VERSION}-linux-x64.tar.xz"
FILEURL="https://nodejs.org/dist/v${NODEJS_VERSION}/${FILENAME}"
curl -O https://nodejs.org/dist/v${NODEJS_VERSION}/SHASUMS256.txt
wget --progress=dot:giga ${FILEURL}
grep $FILENAME SHASUMS256.txt | sha256sum -c -
cp $FILENAME /results/
1.6s
nodejs (Bash)
mkdir -p /opt/nodejs
cd /opt/nodejs
tar -Jxf 
node-v14.16.0-linux-x64.tar.xz
ln -s node-v${NODEJS_VERSION}-linux-x64/ default
4.1s
nodejs (Bash)
/opt/nodejs/default/bin/node --version
1.1s
nodejs (Bash)

https://stackoverflow.com/questions/51811564/sh-1-node-permission-denied#53270214

npm config set user 0 &&
npm config set unsafe-perm true
1.3s
nodejs (Bash)
npm install -g @ceramicnetwork/cli @ceramicstudio/idx-cli
190.5s
nodejs (Bash)

Start a Server

ngrok

region: us
console_ui: true
tunnels:
  btf:
    proto: http
    addr: 7007
    subdomain: btf
ngrok.yml
YAML
echo 'authtoken:' $ngrok | cat - ngrok.yml > /tmp/out && mv /tmp/out ngrok.yml
0.7s
nodejs (Bash)

Start ngrok.

nohup /ngrok start --all --config="/ngrok.yml" &> /tmp/ngrok.log & sleep 1
tail /tmp/ngrok.log
1.9s
nodejs (Bash)

Ceramic

nohup ceramic daemon &> /tmp/ceramic.log & sleep 1
tail /tmp/ceramic.log
1.7s
nodejs (Bash)

    dbus-launch --sh-syntax
1.1s
nodejs (Bash)
dbus-launch
0.8s
nodejs (Bash)

✖ Cannot autolaunch D-Bus without X11 $DISPLAY

D-BUS is an IPC (inter-process communication) mechanism that helps applications communicate with each other. D-Bus  (Desktop  Bus)

So libsecret won't work without an X11 host.

Did you ever figure out the issue with DBus? It's starting to come up more often. It's also a problem when running idx in a container.

As far as I can tell, IDX isn't going to work in a container or a windows linux subsystem because of libsecret. Libsecret wants to launch X11 when idx bootstrap happens. Has anyone found a workaround?

paul: The CLI is meant for development environments to get started quickly, it's not designed with CI or similar environments in mind. If you need to push the IDX config docs to a Ceramic node, using https://developers.idx.xyz/reference/idx-tools/#publishidxconfig is likely a better option.

Huh. That's pretty cool! So I could spin up ceramic in a container. Then from a more traditional local environment, I could run idx and push the example config docs over to the instance. Am I understanding that correctly, @Paul 3⃣ ?

That would work, in concept.

Then I could play around in this configuration, which is really ideal right now.

Once the config is pushed, i could also run IDX commands within the container as well.

If I'm understanding it correctly.

paul: It really depends on your use case, as long as you can provide a Ceramic instance to IDX it doesn't matter if it's running from the demon, docker or a remote server.

idx bootstrap
1.8s
nodejs (Bash)
cat /tmp/ceramic.log
1.0s
nodejs (Bash)
nohup dbus-daemon --session --nopidfile --nofork --address=unix:path=/tmp/dbus &> /tmp/ceramic.log & sleep 1
tail /tmp/ceramic.log
1.8s
nodejs (Bash)
export DBUS_SESSION_BUS_ADDRESS=unix:path=/tmp/dbus
0.6s
nodejs (Bash)
export $(dbus-launch)
dbus-launch
env -u DISPLAY dbus-launch --sh-syntax
gnome-keyring-daemon --start --daemonize --components=secrets
# service dbus start
1.0s
nodejs (Bash)
eval "$(dbus-launch --sh-syntax)"
0.6s
nodejs (Bash)

https://github.com/ceramicstudio/idx-cli/issues/1

https://github.com/jaraco/keyring/issues/477

https://unix.stackexchange.com/questions/473528/how-do-you-enable-the-secret-tool-command-backed-by-gnome-keyring-libsecret-an

https://blog.ceramic.network/how-to-build-a-simple-notes-app-with-idx/

dbus-run-session -- sh
echo 'somecredstorepass' | gnome-keyring-daemon --unlock
nodejs (Bash)

IDX

idx index:get did:key:z6Mkw1Mpfejq2R76AsQo2qJoAVaF6HH5nLDoHrKrsW5Wdnei basicProfile
1.7s
nodejs (Bash)
idx --help
1.2s
nodejs (Bash)
Runtimes (1)