-
Notifications
You must be signed in to change notification settings - Fork 0
Setting up the development environment
If you want to help with development, you'll most likely need to run the site locally.
Note that this setup tutorial is made for Linux, steps should mostly be applicable on Windows too, though.
What you'll need:
- git
- npm
- php
- mysql
$ git clone https://github.com/GamingasCZ/gdlists-vue-frontend
$ cd gdlists-vue-frontend
$ npm i
You can now start the server with npm run dev
and the site will run on http://localhost:5173
.
This will not be of much use though. We also need to setup the backend!
If you don't have mysql set up, install it.
Check if mysql is running
$ systemctl status mysqld.service
# If it's not running, start/enable it
$ sudo systemctl start mysqld.service
Set the root password
$ sudo mysql_secure_installation
MySQL should now be set up. Start from this step, if you've had mysql setup already!
$ sudo mysql -u root -p
# Use the root password to login
# Create a new database
> CREATE database gdlists;
# Somewhere in this repo should be a .sql file called schema.sql. It will create all tables for you. Note that further down the line, more tables and columns will be added, don't forget to update the database
# Make sure you're in the same directory as the schema.sql file
> source schema.sql;
# You can check the tables
> show tables;
# If you see lists, users etc... everything is ok :D
# Quit mysql
(CTRL+C)
Now, we need to make sure the frontend can communicate with the backend.
I recommend making a bash script for this!
Start your script by setting environmental variables:
# Will always be localhost when running locally
export DB_HOSTNAME="localhost"
# May be 'root' or any other username you've set up
export DB_USERNAME="root"
# This is the root password you set in the previous step
export DB_PASSWORD="pass"
# We added all our tables into the gdlists db, do not change this
export DB_NAME="gdlists"
# Come back to this later, after we create a discord app
export DC_CLIENT_ID=""
export DC_CLIENT_SECRET=""
# Make this any random string (must always be same)
export SECRET=""
Next up (still in the script), start the PHP server:
# Change this to the path, where you cloned this repo
cd ~/Build/gdlists-vue-frontend/
sudo systemctl start mysqld.service
php -S localhost:8000