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]
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.
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
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.
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.