DSpeckhals / bible.rs

A Bible server written in Rust using Actix Web and Diesel
https://bible.rs
MIT License
221 stars 24 forks source link

Understanding Of The Bible.Rs Project #77

Closed passionate2023 closed 1 year ago

passionate2023 commented 1 year ago

The technologies used in this project include:

Rust: Rust is a programming language that emphasizes performance, reliability, and safety. It is used to write the Bible server in this project.

Actix Web: Actix Web is a powerful, pragmatic, and extremely fast web framework for Rust. It is used to build the web server in this project.

Diesel: Diesel is a safe, extensible ORM and Query Builder for Rust. It is used to interact with the database in this project. Overall, the project uses a combination of Rust, Actix Web, and Diesel to create a Bible server that is fast, reliable, and safe.

The project in question is a Bible server written in Rust using Actix Web and Diesel

Here are the steps to build this project: Install Rust: To build this project, you need to have Rust installed on your machine. You can download Rust from the official website [https://www.rust-lang.org/tools/install]. Clone the repository: Clone the repository using the following command in your terminal: git clone https://github.com/DSpeckhals/bible.rs.git Install dependencies: Navigate to the project directory and install the dependencies using the following command: cargo build

Set up the database: This project uses a PostgreSQL database. You need to set up a PostgreSQL server and create a database for this project. Once you have set up the database, you need to create the tables by running the following command: diesel migration run

Start the server: You can start the server using the following command: cargo run

Once the server is running, you can access the API by visiting http://localhost:8080 in your web browser.

The GitHub Container Registry uses the namespace "ghcr.io"

The given Docker Compose YAML file describes a multi-container setup for a web application, a gateway (nginx), and a Certbot container for obtaining SSL certificates. Let's break down the file and explain each section:

yaml version: "3.8"

This specifies the version of Docker Compose being used. In this case, it is version 3.8. yaml services: app: image: ghcr.io/dspeckhals/bible.rs:latest

This defines a service named "app" using the Docker image ghcr.io/dspeckhals/bible.rs:latest. It represents the web application container. yaml gateway: image: nginx:1.23.3 ports:

This defines a service named "gateway" using the Docker image nginx:1.23.3. It represents the nginx container acting as a reverse proxy and handling incoming requests. The ports section maps the host machine's ports 80 and 443 to the container's ports 80 and 443, respectively. The volumes section mounts various files and directories from the host machine to specific paths inside the container. The depends_on section specifies that the "gateway" service depends on the "app" service.

yaml certbot: image: certbot/certbot volumes:

This defines a service named "certbot" using the Docker image certbot/certbot. It represents the Certbot container used for obtaining SSL certificates. The volumes section mounts directories from the host machine to specific paths inside the container. The depends_on section specifies that the "certbot" service depends on the "gateway" service. The command section specifies the command to run inside the container, which in this case is the Certbot command for obtaining SSL certificates using the webroot method. yaml volumes: certbot-etc: certbot-var: web-root: driver: local driver_opts: type: none device: $PWD/web/dist/ o: bind

This defines three named volumes: "certbot-etc", "certbot-var", and "web-root". These volumes are used to persist data between container restarts. The "web-root" volume is configured with a local driver and binds the host machine's $PWD/web/dist/ directory to the container's /var/www/html directory.

Overall, this Docker Compose file sets up a web application container, an nginx gateway container, and a Certbot container for obtaining SSL certificates. The containers are connected and configured using the specified images, volumes, ports, and dependencies.

passionate2023 commented 1 year ago

Is my above understanding is correct, please confirm or correct me

DSpeckhals commented 1 year ago

Some of it is correct, but other parts aren't. For example, no PostgreSQL database is used. Only a SQLite database is used.

The explanation of docker-compose.yml is mostly accurate, but it's very basic. This compose file is meant for when it's hosted in some sort of VPC or cloud provider, not for running the program locally.

To start, it would be much better to add a small section of what's required to run on different environments. But as I've stated elsewhere, I haven't tested on other environments, so I'm not going to provide that guidance at the moment. Anyone is welcome to submit a PR though.

passionate2023 commented 10 months ago

How does it very fast using RUST with just SQLIte....