kadena-io / chainweb-data

Data ingestion for Chainweb.
BSD 3-Clause "New" or "Revised" License
14 stars 8 forks source link

A "nixified" docker image #84

Closed emmanueldenloye closed 1 year ago

emmanueldenloye commented 2 years ago

Look at title.

emmanueldenloye commented 1 year ago

We attempted to run the --help command of chainweb-data. Unfortunately, this does not work. We will have to come around back to this work.

[emmanuel@nixos:~/work/chainweb-data]$ docker run -ti chainweb-data-docker:latest -- --help
chainweb-data: internal error: Itimer: Failed to spawn thread: Operation not permitted
    (GHC version 8.10.7 for x86_64_unknown_linux)
    Please report this as a GHC bug:  https://www.haskell.org/ghc/reportabug

EDIT: This error can be avoided if you use a sufficiently recent version of Docker (> 20.10.7).

enobayram commented 1 year ago
$ docker load < $(nix-build docker.nix)
8c9a61e98cef: Loading layer [==================================================>]  75.35MB/75.35MB
The image chainweb-data-docker:latest already exists, renaming the old one with ID sha256:b72cc202fd1112fccafc1761ae7316998c7258eea56073eab45c1b8ff5194972 to empty string
Loaded image: chainweb-data-docker:latest
$ docker run -ti --entrypoint bash chainweb-data-docker:latest
root@907c93b9ceb8:/# ls
bin   chainweb-data  etc   lib    lib64   media  nix  proc  run   srv  tmp  var
boot  dev            home  lib32  libx32  mnt    opt  root  sbin  sys  usr
root@907c93b9ceb8:/# apt-get update
Get:1 http://archive.ubuntu.com/ubuntu jammy InRelease [270 kB]
Get:2 http://archive.ubuntu.com/ubuntu jammy-updates InRelease [114 kB]             
...
Get:18 http://archive.ubuntu.com/ubuntu jammy-backports/main amd64 Packages [3520 B]     
Fetched 25.3 MB in 3s (8227 kB/s)                                                         
Reading package lists... Done
root@907c93b9ceb8:/# apt-get install apcalc
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
...
Unpacking apcalc (2.12.7.2-4) ...
Setting up calc-common (2.12.7.2-4) ...
Setting up readline-common (8.1.2-1) ...
Setting up libreadline8:amd64 (8.1.2-1) ...
Setting up calc (2.12.7.2-4) ...
Setting up apcalc (2.12.7.2-4) ...
Processing triggers for libc-bin (2.35-0ubuntu3.1) ...
root@907c93b9ceb8:/# /nix/store/322q18wf7hlg4hgn77m0jk9llm15yvk1-chainweb-data-2.1.0/bin/chainweb-data --help
chainweb-data - Processing and analysis of Chainweb data

Usage: chainweb-data (COMMAND | COMMAND | COMMAND 
                       [--dbstring ARG | [--dbhost ARG] [--dbport ARG] 
                         [--dbuser ARG] [--dbpass ARG] --dbname ARG |
                         --dbdir ARG] [--service-https] --service-host HOST 
                       [--service-port PORT] --p2p-host HOST [--p2p-port PORT] 
                       [--level ARG] [(-m|--migrate) | --ignore-schema-diff])

Available options:
  --dbstring ARG           Postgres Connection String
  --dbhost ARG             Postgres DB hostname
  --dbport ARG             Postgres DB port
...
root@907c93b9ceb8:/# 

This is great, I love it!

enobayram commented 1 year ago

@emmanueldenloye would be nice to experiment a little bit and see how this image plays with a Dockerfile that uses this image in its FROM. In particular, would be nice to see if it behaves exactly like an Ubuntu 22.04 image + the chainweb-data binary we're injecting.