Skip to content

Commit

Permalink
feat: 🎸 vps (#1587)
Browse files Browse the repository at this point in the history
install on your own server doc

# Description

Please include a summary of the changes and the related issue. Please
also include relevant motivation and context.

## Checklist before requesting a review

Please delete options that are not relevant.

- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my code
- [ ] I have commented hard-to-understand areas
- [ ] I have ideally added tests that prove my fix is effective or that
my feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged

## Screenshots (if appropriate):
  • Loading branch information
StanGirard authored Nov 5, 2023
1 parent 769c0a5 commit 249f978
Show file tree
Hide file tree
Showing 3 changed files with 201 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,5 @@ package-lock.json
backend/celerybeat-schedule
frontend/public/robots.txt
frontend/public/sitemap*

pyfiles/*
112 changes: 112 additions & 0 deletions docker-compose.local.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
version: "3"

services:
traefik:
image: traefik:v2.7
container_name: traefik
command:
- "--api.insecure=true"
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--entrypoints.web.address=:80"
- "--entrypoints.websecure.address=:443"
- "--certificatesresolvers.myresolver.acme.tlschallenge=true"
- "--certificatesresolvers.myresolver.acme.email=${EMAIL}"
- "--certificatesresolvers.myresolver.acme.storage=/letsencrypt/acme.json"
ports:
- "80:80"
- "443:443"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
- "./letsencrypt:/letsencrypt"
restart: always
env_file:
- .env

frontend:
env_file:
- ./frontend/.env
build:
context: frontend
dockerfile: Dockerfile
container_name: web
restart: always
labels:
- "traefik.enable=true"
- "traefik.http.routers.frontend.rule=Host(`${DOMAIN_NAME}`)"
- "traefik.http.routers.frontend.entrypoints=websecure"
- "traefik.http.routers.frontend.tls.certresolver=myresolver"
depends_on:
- traefik

backend-core:
env_file:
- ./backend/.env
build:
context: backend
dockerfile: Dockerfile
container_name: backend-core
restart: always
volumes:
- ./backend/:/code/
depends_on:
- redis
- worker
- beat
- traefik
labels:
- "traefik.enable=true"
- "traefik.http.routers.backend-core.rule=Host(`${API_DOMAIN_NAME}`)"
- "traefik.http.routers.backend-core.entrypoints=websecure"
- "traefik.http.routers.backend-core.tls.certresolver=myresolver"
- "traefik.http.services.backend-core.loadbalancer.server.port=5050"

redis:
image: redis:latest
container_name: redis
restart: always

worker:
env_file:
- ./backend/.env
build:
context: backend
dockerfile: Dockerfile
container_name: worker
command: celery -A celery_worker worker -l info
restart: always
depends_on:
- redis

beat:
env_file:
- ./backend/.env
build:
context: backend
dockerfile: Dockerfile
container_name: beat
command: celery -A celery_worker beat -l info
restart: always
depends_on:
- redis

flower:
env_file:
- ./backend/.env
build:
context: backend
dockerfile: Dockerfile
container_name: flower
command: celery -A celery_worker flower -l info --port=5555
restart: always
depends_on:
- redis
- worker
- beat
labels:
- "traefik.enable=true"
- "traefik.http.routers.flower.rule=Host(`flower.${API_DOMAIN_NAME}`)"
- "traefik.http.routers.flower.entrypoints=websecure"
- "traefik.http.routers.flower.tls.certresolver=myresolver"
- "traefik.http.services.flower.loadbalancer.server.port=5555"

87 changes: 87 additions & 0 deletions docs/docs/Developers/vps_install.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
---
title: Install on your Server
---

# Quivr Installation Guide on Ubuntu 22 Server

Welcome to the installation guide for Quivr, your go-to open-source project . This tutorial will walk you through the process of setting up Quivr on an Ubuntu 22.04 server with Docker and Traefik, ensuring a secure HTTPS connection for your domains.

## Table of Contents
- [Quivr Installation Guide on Ubuntu 22 Server](#quivr-installation-guide-on-ubuntu-22-server)
- [Table of Contents](#table-of-contents)
- [Prerequisites](#prerequisites)
- [Step-by-Step Installation](#step-by-step-installation)
- [Step 1: Clone Quivr Repository](#step-1-clone-quivr-repository)
- [Step 2: Create `.env` File](#step-2-create-env-file)
- [Step 3: Configure `.env` Files for Backend and Frontend](#step-3-configure-env-files-for-backend-and-frontend)
- [Step 4: Launch Quivr with Docker Compose](#step-4-launch-quivr-with-docker-compose)
- [Step 5: Verify Installation](#step-5-verify-installation)
- [Additional Information](#additional-information)

## Prerequisites
Before diving into the installation process, please ensure you have the following ready:

- An **Ubuntu 22.04 server** with at least **20 GB of free disk space**.
- **Docker** installed. If you haven't done this yet, no worries! Follow the official [Docker Installation Guide for Ubuntu](https://docs.docker.com/engine/install/ubuntu/).
- **DNS records** configured to point to your server. You will need records for the following:
- `flower.api.<yourdomain>`
- `api.<yourdomain>`
- `<yourdomain>`

> Replace `<yourdomain>` with your actual domain name throughout this guide.
## Step-by-Step Installation

### Step 1: Clone Quivr Repository
Let's get started by cloning the Quivr repository onto your server. Open your terminal and run:

```bash
git clone https://github.com/StanGirard/quivr.git
cd quivr
```

### Step 2: Create `.env` File
Now, let's set up your environment variables. In the root directory of the Quivr project, create a `.env` file:

```bash
nano .env
```

Add the following lines, making sure to replace the placeholders with your information:

```
[email protected]
DOMAIN_NAME=quivr.yourdomain.com
API_DOMAIN_NAME=api.quivr.yourdomain.com
```

Don't forget to save your changes (`Ctrl+X`, then `Y`, and `Enter`).

### Step 3: Configure `.env` Files for Backend and Frontend
Next, configure the `backend/.env` and `frontend/.env` files as per the Quivr documentation. You'll fill in various settings specific to your setup.

### Step 4: Launch Quivr with Docker Compose
With your `.env` files ready, it's time to start up Quivr using Docker Compose. This step is exciting because it's when things come to life!

```bash
docker-compose -f docker-compose.local.yml up
```

The `docker-compose.local.yml` file includes **Traefik**, which automagically handles HTTPS certificates for you.

### Step 5: Verify Installation
Once everything is up and running, give yourself a pat on the back and verify that the services are accessible:

- Visit `https://quivr.yourdomain.com`
- And `https://api.quivr.yourdomain.com`

You should be greeted by your new Quivr setup, all shiny and secure!

## Additional Information

- **Firewall Settings**: Ensure that ports 80 (HTTP) and 443 (HTTPS) are open. Traefik will handle the rest, including redirecting HTTP to HTTPS for you.
- **Updates**: Keep an eye on the [Quivr GitHub repository](https://github.com/StanGirard/quivr) for any updates to maintain security and performance.

> Always use HTTPS for production environments to ensure the security of your data and communications.
**Congratulations!** Your Quivr server should now be successfully installed and secured with HTTPS. Happy project managing!

0 comments on commit 249f978

Please sign in to comment.