ex-CBDC Sandbox Deployment Issues

Looking at the log, it seems that you have placed the ledger Id within the square brackets.

I.e. you have replaced this

LEDGER_ID=[Ledger ID]

with this

LEDGER_ID=[y4ir1y9bd2z3i3ta]

instead of this

LEDGER_ID=y4ir1y9bd2z3i3ta

The result is that the URL is wrong as can be seen in the log (e.g.

POST https://api.projectdabl.com/data/[y4ir1y9bd2z3i3ta]/v1/exercise

instead of

POST https://api.projectdabl.com/data/y4ir1y9bd2z3i3ta/v1/exercise

Could you retry it?

Best,
Darko

I tried without the brackets first and it wasn’t working(error) so had to change it. I’ll try once again. Thanks @Darko

I believe api.projectdabl.com no longer works and you have to upgrade to the new hub domains. I recommend taking a look at the version of create-daml-app in SDK 2.1 and copying the hub interaction from that.

@Darko this is the error I’m getting after I run make daml-hub-package LEDGER_ID=[Ledger ID]

> react-scripts build

Creating an optimized production build...
Failed to compile.

/home/ubuntu/ex-cbdc/ui/src/components/App.tsx
TypeScript error in /home/ubuntu/ex-cbdc/ui/src/components/App.tsx(103,27):
Argument of type 'FC<{}>' is not assignable to parameter of type 'ComponentClass<RouteComponentProps<any, StaticContext, unknown>, any> | FunctionComponent<RouteComponentProps<any, StaticContext, unknown>> | (FunctionComponent<...> & ComponentClass<...>) | (ComponentClass<...> & FunctionComponent<...>)'.
  Type 'FunctionComponent<{}>' is not assignable to type 'FunctionComponent<RouteComponentProps<any, StaticContext, unknown>>'.
    Types of parameters 'props' and 'props' are incompatible.
      Type 'RouteComponentProps<any, StaticContext, unknown>' has no properties in common with type '{ children?: ReactNode; }'.  TS2345

    101 | };
    102 |
  > 103 | export default withRouter(App);
        |                           ^
    104 |


npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! cbdc@1.0.0 build: `react-scripts build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the cbdc@1.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/ubuntu/.npm/_logs/2022-04-19T12_44_52_588Z-debug.log
make[1]: *** [Makefile:42: cbdc-ui.zip] Error 1

I removed the package-lock.json file as well from /ui folder before running make daml-hub-package LEDGER_ID=[Ledger ID]

As @cocreature mentioned, it seems that we’ll need to update the project to capture the change in the daml hub API.

Before that you could either run it locally or if you are comfortable using docker, I can send you a Dockerfile.

Please find attached a quick and dirty Dockerfile just to get you up and running.

FROM digitalasset/daml-sdk:1.17.1

USER root
RUN apt update && apt install git make netcat npm -y

USER daml
WORKDIR /home/daml
RUN git clone https://github.com/digital-asset/ex-cbdc.git
WORKDIR /home/daml/ex-cbdc/
RUN git checkout d0ec4b0989aa7245953bf651044dd23fd3fd75bb

WORKDIR /home/daml/ex-cbdc/ui
RUN rm ./package-lock.json

WORKDIR /home/daml/ex-cbdc
RUN make build


WORKDIR /home/daml/ex-cbdc

CMD launchers/sandbox & \
  launchers/populate & \
  launchers/jsonapi & \
  launchers/automation & \
  launchers/ui

EXPOSE 3000

To use it follow the following steps:

  1. Create a file called Dockerfile in the root folder of the repository (i.e. in the ex-cbdc folder).
  2. copy the code above into that file.
  3. Run docker build . -t ex-cbdc to create the docker image. This might take a few minutes.
  4. run docker run ex-cbdc and wait until you see
You can now view cbdc in the browser.

  Local:            http://localhost:3000
  On Your Network:  http://172.17.0.3:3000
  1. Open a browser on http://localhost:3000

Hi @Darko

I’m still getting the following error:

Failed to compile.

/home/daml/ex-cbdc/ui/src/components/App.tsx
TypeScript error in /home/daml/ex-cbdc/ui/src/components/App.tsx(103,27):
Argument of type 'FC<{}>' is not assignable to parameter of type 'ComponentClass<RouteComponentProps<any, StaticContext, unknown>, any> | FunctionComponent<RouteComponentProps<any, StaticContext, unknown>> | (FunctionComponent<...> & ComponentClass<...>) | (ComponentClass<...> & FunctionComponent<...>)'.
  Type 'FunctionComponent<{}>' is not assignable to type 'FunctionComponent<RouteComponentProps<any, StaticContext, unknown>>'.
    Types of parameters 'props' and 'props' are incompatible.
      Type 'RouteComponentProps<any, StaticContext, unknown>' has no properties in common with type '{ children?: ReactNode; }'.  TS2345

My current setup:

Java

openjdk 17.0.1 2021-10-19
OpenJDK Runtime Environment Temurin-17.0.1+12 (build 17.0.1+12)
OpenJDK 64-Bit Server VM Temurin-17.0.1+12 (build 17.0.1+12, mixed mode, sharing)

DAML

SDK versions:
  1.18.1  (default SDK version for new projects)
  2.0.0   (not installed)

Node

v14.19.1

Python 3 is installed as well.

I’m currently running the whole setup on AWS EC2 Ubuntu 20.04

I created the Dockerfile as you suggested and ran docker build and docker run and the error above is what I got.

@Darko I’m on windows and it didn’t work on it before(open issue on github) so testing on EC2 box.

Hi @mvresh,

I can confirm I see the same error when running that Dockerfile on my machine. As that looks like a compilation error, it seems to imply the TypeScript code in the repo is somehow broken, despite passing CI. We’ll need to look into this more closely.

The following Dockerfile, however, does work for me:

FROM digitalasset/daml-sdk:1.18.1

USER root
RUN apt update && apt install git make netcat npm -y

USER daml
WORKDIR /home/daml
RUN git clone https://github.com/digital-asset/ex-cbdc.git
WORKDIR /home/daml/ex-cbdc/
RUN git checkout 1a42e24d053b85476dbbc7ae4d4dabdd631131c4
RUN make build

CMD launchers/sandbox & \
  launchers/populate & \
  launchers/jsonapi & \
  launchers/automation & \
  launchers/ui

EXPOSE 3000

Would you mind trying it?

Hi @Gary_Verhaegen Thanks for responding.

I tried the new Dockerfile on AWS EC2 Ubuntu 20.04, with the prerequisites installed and I didnt get any errors as of yet but its taking a really long time after the sandbox started running. I’m yet to see the UI launcher running and its not deployed yet for sure.

Yes, there’s a lot of “building” that still happens when running docker run, so it takes a while. It just end up with a message that the server is listening to port 3000.

Note that the Docker container ultimately just opens up port 3000 and stays there, listening; in order to see the UI you have to open up a browser and connect to that. With a remote machine, I don’t know exactly how that works; you’ll probably need to record the IP address of the machine and make sure you have all the network rules set up so the machine is reachable.

Thanks @Gary_Verhaegen It got deployed and I’m able to access the Ui but still facing the same issues as before - Cant issue funds and no initial funds. I think JSON API is still not accessible to the UI.

Hi @mvresh,

Apologies, I am not very familiar with this application. It looks like you need to set the URL you will use to access the site at build time.

In your case, that will probably be the IP address of the Amazon VM you are using. In my case, Docker runs on a VM that I can access using the 192.168.99.163 IP address, and the following Dockerfile works:

FROM digitalasset/daml-sdk:1.18.1

USER root
RUN apt update && apt install git make netcat npm -y

USER daml
WORKDIR /home/daml
RUN git clone https://github.com/digital-asset/ex-cbdc.git
WORKDIR /home/daml/ex-cbdc/
RUN git checkout 1a42e24d053b85476dbbc7ae4d4dabdd631131c4
RUN make build

ENV REACT_APP_HTTP_BASE_URL=http://192.168.99.163:3000/

CMD launchers/sandbox & \
  launchers/populate & \
  launchers/jsonapi & \
  launchers/automation & \
  launchers/ui

Note the new ENV line. You’ll have to replace the IP address with the one you are using.

I’ll also note that on my machine it seems to work with Chrome but does not seem to work with Safari or Firefox.