Code Monkey home page Code Monkey logo

chipmunk's Introduction

Chipmunk

Install rust

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Customize the installation as desired or just continue with the default options.

To get started you may need to restart your current shell. This would reload your PATH environment variable to include Cargo's bin directory ($HOME/.cargo/bin). To configure your current shell, run: source "$HOME/.cargo/env"

Install dependencies

# Debian/Ubuntu
sudo apt install libssl-dev

# OpenSUSE
sudo zypper install libopenssl-3-devel

# Fedora
sudo dnf install openssl-devel

Create .env

Copy env.example to .env and fill in the values.

Build the project

cargo build

Setup Development Environment

Run this command to start the development containers and drop into rust build container.

./dev-environment.sh start

The application can be built with cargo build in the rust development container.

Building docker image

docker-compose build

Build and run the container

docker-compose up --build --force-recreate --remove-orphans

Using the container

  • Create mount points
mkdir -p chipmunk_docker/postgres
mkdir -p chipmunk_docker/grafana

sudo chown -R 472:0 chipmunk_docker/grafana
sudo chown -R 5050:5050 chipmunk_docker/pgadmin
  • Start the container
docker-compose up

Building offline without database access

The sqlx crate requires access to a database to compile successfully. Follow these steps to build the project offline, without active database connection.

sqlx might fail to generate the files needed to build offline if the versions of sqlx and sqlx-cli are not the same. To ensure that the versions are the same, run the following command to install sqlx-cli:

cargo install sqlx-cli

Then run the following command to generate the files needed to build offline:

cargo sqlx prepare --workspace -- --all-targets --all-features

Force building in offline mode

The presence of a DATABASE_URL environment variable will take precedence over the presence of .sqlx, meaning SQLx will default to building against a database if it can. To make sure an accidentally-present DATABASE_URL environment variable or .env file does not result in cargo build (trying to) access the database, set the SQLX_OFFLINE environment variable to true.

To make this the default, add it to .env file. cargo sqlx prepare will still do the right thing and connect to the database.

Testing

cargo test will run tests parallely in different threads. Some of the tests in this project uses shared resources (database, http server, etc.) and will fail cargo test. One option is to run the tests sequentially which will take a long time to run the tests.

Alternatively, we can use test frameworks like cargo-nextest to run the tests parallely without interferring with each other.

cargo install cargo-nextest
cargo nextest run

chipmunk's People

Contributors

rahul-r avatar dependabot[bot] avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.