Skip to content

Latest commit

 

History

History
103 lines (71 loc) · 2.35 KB

CONTRIBUTING.md

File metadata and controls

103 lines (71 loc) · 2.35 KB

Contribution guide

Setting up your environment

Prerequisites

You'll need:

  • PNPM — Node package manager. A superior NPM. Using this is required to develop on loca7, since the project has a pnpm-specific lockfile.
  • Docker, or a MySQL server — Container management system-we'll only use it to install a MySQL server.
  • Git — I hope you know what this is
  • Mailhog — debug email client that catches all mail

Getting the source code

git clone https://git.inpt.fr/inp-net/loca7
cd loca7

Installing dependencies

pnpm i

Filling out the .env file

Create a new .env file at the project's root, and fill it out with this:

DATABASE_URL=mysql://root:root@localhost:3306/loca7 # or whatever your connection string is.
# note that if you change any of the MAIL_* values, you have to change them in mailhog/
MAIL_HOST=127.0.0.1
MAIL_PORT=1025
MAIL_USER=test
MAIL_PASS=test
CHURROS_CLIENT_ID=... # see https://churros.inpt.fr/developers -- put http://localhost:5173/login/callback in the Allowed Redirect URIs
CHURROS_CLIENT_SECRET=...
OPENROUTESERVICE_KEY=... # see https://openrouteservice.org -- the API is completely free

Setting up the database

  1. Install mysql (skip this if you already have a MySQL installation)
docker run --name loca7-mysql -e MYSQL_ROOT_PASSWORD=root -p 3306:3306 --mount source=mysql,target=/var/lib/mysql -d mysql
  1. Create database & allow all hosts to access root user
$ docker exec -it loca7-mysql mysql -u root -p
Enter password: root
mysql> create database loca7;
mysql> update mysql.user set host='%' where host='localhost' and user='root';
mysql> flush privileges;
  1. Create tables
pnpm prisma migrate reset
  1. Seed with data (optional)

For now, contact me via email to obtain a zip file of seeding data. Then:

pnpm prisma db seed

Launching

  1. Launch the database (if it's not already up)
docker start loca7-mysql
  1. Launch the mailhog server
pnpm mailhog &
  1. Launch the SvelteKit server
pnpm dev

Editing the database manually and recieving mails via mailhog

  1. Launch prisma studio
pnpm prisma studio
  1. The mailhog client is on http://localhost:8025