Skip to content

thomas-mauran/Polypedia

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Polypedia

spirited away gif where big doors are opening one after the others

What is it ?

Polypedia is a school project for polytech montpellier DO which goal is to make anyone able to deploy it's own library. Rather it is to make a small library with your friends or to make an online school library. Users can create accounts, upload and find pdf to download or consults them online !

Steps to run the project :

Docker compose

Docker

lightweight config to create a polypedia full instance on any device you need.

⚠️ a reverse proxy service is not included in this setup you will had to add one to the docker compose file if you wanna use this config on a real server.

prerequisites

To run this project you must have installed docker-compose and docker on your machine

1. Clone the repo

git clone git@github.com:thomas-mauran/Polypedia.git

2. Open the newly cloned repo

cd Polypedia

3. Fill in the frontend and backend .env.examples

Once filled with the desired data remove the .example from both file names.

4. Run docker-compose

docker-compose up

this command will launch 3 containers working together :

  • the vue frontend container

  • the rest api backend container

  • the postgres container

k3d setup

Kubernetes

⚠️ the included kubernetes deployment are using my dockerhub default images which include raw .env. If you wanna use your own config make sure you build tag and push to docker hub your versions of the Dockerfiles modified and modify the deployments to retrieve those images.

prerequisites

To run this project you will need k3d and kubernetes tools. You might want to setup k9s to manage you k3d cluster easily.

1. Clone the repo

git clone git@github.com:thomas-mauran/Polypedia.git

2. Open the newly cloned repo

cd Polypedia

3. File modifications

api-configmap

  • You need to fill the api configmap with the desired values used to override the api .env
modify ingress-controller routes
  • The ingress controller is set with my own server url as example. Make sure you change those values according to your domain name and DNS.
modify both certificate staging / production.
  • Those files are also using my example server domain names. Make sure you change those values according to your domain name and DNS.
modify both certificate issuers staging / production
  • Use your own email address in those files.

4. create the k3d cluster

k3d cluster create polypedia --k3s-arg "--no-deploy=traefik@server:*"

this command is going to setup a basic k3d cluster without any traefik server.

5. apply the kube files

kubectl apply -f kube/

6. nginx ingress controller

helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx


helm repo update

helm upgrade --install ingress-nginx ingress-nginx \
  --repo https://kubernetes.github.io/ingress-nginx \
  --namespace ingress-nginx --create-namespace

7. Create the img and pdf folders in the cluster container

use docker ps to check the container id with the image "rancher/k3s:v1.24.4-k3s1"

docker ps 

select the contained id and use it in the following command

docker exec -it <container id> sh 

once you are in the file system

mkdir /mnt/data/polypedia/files/img
mkdir /mnt/data/polypedia/files/pdf

8. Setup certmanager

kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.10.1/cert-manager.yaml

kubectl apply -f kube/

9. Open k3d cluster ports

k3d node edit k3d-polypedia-serverlb --port-add 80:80

k3d node edit k3d-polypedia-serverlb --port-add 443:443

Questions

You can create issues if you are having troubles seting up the project !