This example makes use of rocket.rs TODO App complete with GitHub actions pushed to DOM Cloud server.
But instead of pulling code changes, we build the binary in GitHub CI and push it to server, avoiding extra storage cost by installing rust feature and compiling depedencies compared to classic webhook mentioned in the documentation.
This project demo live here: http://rocket-rs-todo-app.domcloud.dev/ (note the db is lives in mem)
This CI used SSH identifier keys instead of SSH password, so there's extra step you need to do in the server SSH:
ssh-keygen -t rsa -b 4096 -C youremail@example.com
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
chmod 0600 ~/.ssh/authorized_keys
Examine the secret key by cat ~/.ssh/id_rsa then add it to SSH_KEY action secrets.
Try checking this repo CI scripts
The NGINX setup would be like this:
nginx:
root: public_html/public
passenger:
enabled: 'on'
app_start_command: env ROCKET_PORT=$PORT ./todoWhen building from CI, note the differences between our servers and CI servers. If you find yourself unable to run due to lack of required shared library, then you also need to compile the given shared library and push it too to the server.
For example in this example, the project require to have libsqlite3 library in the system but since DOM Cloud servers having this shared library already, we don't need to copy this shared library.
See our guide for installing shared libraries
Avoid embedding or hardcoding paths that evalues at build time, e.g. relative! macro originally used in this example are removed to make this example works.