Run a SolidJS/SolidStart app
This guide shows how to deploy a Solid Start app. To do so, follow these steps:
-
Install the
kraft
CLI tool and a container runtime engine, e.g. Docker. -
Clone the
examples
repository andcd
into theexamples/node21-solid-start/
directory:
git clone https://github.com/kraftcloud/examplescd examples/node21-solid-start/
Make sure to log into Unikraft Cloud by setting your token and a metro close to you.
We use fra0
(Frankfurt, 🇩🇪) in this guide:
# Set Unikraft Cloud access tokenexport UKC_TOKEN=token# Set metro to Frankfurt, DEexport UKC_METRO=fra0
When done, invoke the following command to deploy the application on Unikraft Cloud:
kraft cloud deploy -p 443:3000 -M 256 .
The output shows the instance URL and other details:
[●] Deployed successfully! │ ├────────── name: node21-solid-start-lvoa2 ├────────── uuid: 4e6ccb1f-0533-4dc1-be67-eca8dfc1f8c6 ├───────── state: running ├─────────── url: https://long-star-1tms9h1z.fra0.kraft.host ├───────── image: node21-solid-start@sha256:eb2e79b2fc5c28bb43923a1fc4931db94ebc3f939a6fbe00d06189c0ae2e02fd ├───── boot time: 67.65 ms ├──────── memory: 256 MiB ├─────── service: long-star-1tms9h1z ├── private fqdn: node21-solid-start-lvoa2.internal ├──── private ip: 172.16.6.8 └────────── args: /usr/bin/node /usr/src/server/index.mjs
In this case, the instance name is node21-solid-start-lvoa2
and the URL is https://long-star-1tms9h1z.fra0.kraft.host
.
They are different for each run. You can now point your browser at the URL to see your deployed instance.
At any point in time, you can list information about the instance:
kraft cloud instance list
NAME FQDN STATE CREATED AT IMAGE MEMORY ARGS BOOT TIMEnode21-solid-start-lvoa2 long-star-1tms9h1z.fra0.kraft.host running 1 minutes ago node21-sol... 256 MiB /usr/bin/node /usr/src/server... 67.65 ms
When done, you can remove the instance:
kraft cloud instance remove node21-solid-start-lvoa2
Customize your Application
To customize the application, update the files in the repository, listed below:
Kraftfile
: the Unikraft Cloud specificationDockerfile
: the Docker-specified application filesystemsrc/
: server source files
spec: v0.6
runtime: node:21
rootfs: ./Dockerfile
cmd: ["/usr/bin/node", "/usr/src/server.js"]
FROM node:21-alpine AS build
WORKDIR /usr/src
COPY . /usr/src/
RUN set -xe && \npm instal -g pnpm && \pnpm install && \pnpm build
FROM scratch
COPY --from=build /usr/src/.output/ /usr/src/
Learn More
Use the --help
option for detailed information on using Unikraft Cloud:
kraft cloud --help
Or visit the CLI Reference.