Skip to content

Example repo to Deploy Rust to DOM Cloud with SCP Webhook

Notifications You must be signed in to change notification settings

domcloud/example-rust-todo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Example Project: Rust Example

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)

Add server ID Key

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 [email protected]
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

NGINX Setup

The NGINX setup would be like this:

nginx:
  root: public_html/public
  passenger:
    enabled: 'on'
    app_start_command: env ROCKET_PORT=$PORT ./todo

Caveats when using this method

Shared libraries

When 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

Embedding paths

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.

About

Example repo to Deploy Rust to DOM Cloud with SCP Webhook

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published