Skip to content

richardhenry/nano-server

Repository files navigation

nano-server

This is the companion server for the Nano app. It is released under the MIT license.

Setup for Production

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.

Setup for Development

These instructions assume that you are using macOS and have Homebrew installed.

  1. Install Rust:
    curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh &&
    rustup component add rustfmt
  2. Install cmake:
    brew install cmake
  3. Install PostgreSQL:
    brew install postgresql@16 &&
    brew link postgresql@16 &&
    brew services start postgresql@16
  4. Install Redis:
    brew install redis
  5. Start Redis in cluster mode. See helpers/redis-cluster-dev/README.md for suggestions on how to do this in development without the overhead of Docker or virtualization.
  6. Create a .env file 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"
  7. Create a .env.test file 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"
  8. Run PostgreSQL setup:
    psql postgres -f sql/setup.sql
  9. Install the sqlx-cli binary:
    cargo install sqlx-cli
  10. For automatic code reloading, install cargo-watch:
    cargo install cargo-watch

Development

Run tests:

./test

Run debug server:

./run_debug

Reset your local database:

./reset_db

About

The server for nano-swift

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages