This is the companion server for the Nano app. It is released under the MIT license.
The server is designed to run in a Kubernetes cluster alongside high-availability Postgres and Redis. Configuration files can be found in the infra/k8s/ directory. Provided storage classes are for Azure, but could easily be modified to run on GKE or EKS instead. A GitHub workflow for deployment is also provided at infra/github/workflows/main-deploy.yml.
These instructions assume that you are using macOS and have Homebrew installed.
- Install Rust:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh && rustup component add rustfmt
- Install cmake:
brew install cmake
- Install PostgreSQL:
brew install postgresql@16 && brew link postgresql@16 && brew services start postgresql@16
- Install Redis:
brew install redis
- Start Redis in cluster mode. See
helpers/redis-cluster-dev/README.mdfor suggestions on how to do this in development without the overhead of Docker or virtualization. - Create a
.envfile in the root of the repository containing:export DATABASE_URL="postgresql://nano_server@localhost/nano" export REDIS_URL="redis+cluster://localhost:6380" export RUST_LOG="debug"
- Create a
.env.testfile in the root of the repository containing:export DATABASE_URL="postgresql://nano_server@localhost/nano_test" export REDIS_URL="redis+cluster://localhost:6380" export RUST_LOG="debug"
- Run PostgreSQL setup:
psql postgres -f sql/setup.sql
- Install the
sqlx-clibinary:cargo install sqlx-cli
- For automatic code reloading, install cargo-watch:
cargo install cargo-watch
./test./run_debug./reset_db