Skip to content

Latest commit

 

History

History

backend

Backend for: The Open Source AI Challenge

https://dev.to/challenges/pgai

The backend was built in PHP using the laravel framework, and it contains several components:


Local Development Setup Guide

Step 1: Download / Clone the Project

Clone this repository and navigate into it. If you are on Windows, I recommend using WSL2, or at least utilize Git Bash instead of CMD or PowerShell to execute the next commands along.

Step 2: Download mkcert

Download mkcert, a tool for generating self-signed SSL certificates. Get the binary from the release page.

Execute the following command in your terminal after obtaining the mkcert binary:

mkcert -install -cert-file ./traefik/tls/cert.pem -key-file ./traefik/tls/key.pem "*.docker.localhost" docker.localhost

Note: If you are on Windows using WSL2, you have to run this command on the Windows side. This is because mkcert needs to install the certificates in your Windows trust store, not on Linux.

Step 3: Start the Containers

  • Build the images and start the containers with:
cp .env.example .env
docker compose up -d
  • Ensure correct file permissions for modified files within the container. Set the entire directory's ownership to the user with a UID of 1000:
chown -R 1000:1000 .

Note: This is because the container runs as a non-root user with a UID of 1000.

Make necessary scripts executable:

chmod +x ./php ./composer ./ollama

Install dependencies and prepare framework:

./composer install
./php artisan key:generate
./php artisan migrate:fresh
./php artisan storage:link
./ollama pull llama3.2:3b
./ollama pull mxbai-embed-large

Note: The ./ at the beginning of each command is an alias to docker compose exec php, allowing you to run commands within the container without entering it.

You're done! these domains will be available for you: