The Fablab is a laboratory of the HEIG-VD school where mainly students can realize all kinds of works with the help of machines / devices or others. These works are generally requested by students to technicians / experts. The management of these requests does not suit the fablab managers and a dedicated web platform to manage these requests has already been the subject of a previous Bachelor thesis. As the application is not totally finished and deployed, a fresh Bachelor thesis has been proposed in order to improve and complete it.
The final web platform will allow a better management of exchanges and orders. It will also provide a new dimension to the tracking and administration of the laboratory.
A clear procedure from the request to the realization of the requested work will also be implemented through this application.
To facilitate the follow-up of customer requests, the platform will set up a notification system by email and on the application itself.
As the web tool is intended to reach school users, authentication via a school authentication (HEIG or Switch edu-id) tool will be provided.
No installation is needed, you just need to run your favorite browser and go to the following link:\ http://tb22-berney.heig-vd.ch/
To contribute to this project, you need to install a few dependencies that we will explain later.
Tool | Version |
---|---|
PHP | 8.1.8 |
Composer | 2.3.9 |
Laravel | 9.2 |
Laravel Sail | 1.0.1 |
Docker Desktop | 4.10.1 |
WSL Ubuntu | 20.04 |
First thing to do is to install Docker on Linux or Docker Desktop on Windows.
If you are running Windows as OS, you need to install WSL 2.0. \ Here is a link to the documentation: \ https://docs.microsoft.com/en-us/windows/wsl/install
Here is how you can use Docker and WSL 2 together: https://docs.docker.com/desktop/windows/wsl/
If you want to not use sudo to use Docker commands: https://docs.docker.com/engine/install/linux-postinstall/
You'll perhaps have CRLF / LF problems. To avoid them you can use the following commands:
sudo git config core.autocrlf false
git rm --cached -r .
git config --global --add safe.directory /home/<username>/<path>/fablab-manager
git reset --hard
sudo chown -R <username> fablab-manager/
Now you have Docker installed and have a Linux or WSL running, you need to install PHP on your Linux or WSL.
Here is a nice link to help you: https://computingforgeeks.com/how-to-install-php-on-ubuntu-linux-system/
You need to care to have the following extensions installed:
Now you've installed php, you need to install Composer on your Linux or WSL.
Here is a link to install it: https://getcomposer.org/doc/00-intro.md
You can also run this command:
sudo apt-get install composer
You'll perhaps need to add some permissions (you are in project folder):
sudo chmod 777 /home/<username>/<path>/fablab-manager/
sudo chmod -R 777 storage
sudo chmod -R 777 bootstrap/
Be sure you are in the project freshly cloned.
cd fablab-manager
Start by running this command to install dependencies:
composer install
Get the sail environment ready:
cp .env.dev.example .env
Add public key given by manager Yves Chevallier to the .env variable:
KEYCLOAK_REALM_PUBLIC_KEY=
Project use Laravel Sail, to start it, run the following command:
vendor/bin/sail up -d
or
./vendor/bin/sail up -d
Generate your key for the first time:
vendor/bin/sail artisan key:generate
Add job category images to storage for seeding:
mkdir storage/app/public/images
cd job-categories-images
cp cat1.jpg cat2.jpg cat3.jpg cat4.jpg cat5.jpg cat6.jpg cat7.jpg cat8.jpg cat9.jpg ../storage/app/public/images
cd ..
Run the migrations and seeds:
vendor/bin/sail artisan migrate:fresh --seed
Create the link for public storage:
vendor/bin/sail artisan storage:link
You have now the Laravel backend running!
We are using the classic git flow, so if you don't know what i'm speaking about, check the wiki:\ https://github.com/heig-fablab/fablab-manager/wiki/Git-flow \ or in the internet:\ https://blog.bespinian.io/posts/git-the-important-parts/gitflow.png
To run all tests you can run the following command:
vendor/bin/sail test
To run a specific test you can run the following command:
vendor/bin/sail test --filter FileName
As we develop with Laravel Sail, the library MailHog is available, watch the test mail send at this address: \ http://localhost:8025/
Websockets are used in this project.
If you have a problem with websockets, you can try to run sail like this:
vendor/bin/sail up -d --build
You can see all websockets movement here: \ http://localhost:<port - default 3000>/laravel-websockets
Seeders already creates all data necessary to make work the program.\ They also create some fake data when you aren't in production environment.
You just need to add the job category images in the folder "storage/public/file-storage/cat". \ They must be named: "cat_id.png". \ Job Category has actually 9 entries, so you need to add 9 images.
cd job-categories-images
cp cat1.jpg cat2.jpg cat3.jpg cat4.jpg cat5.jpg cat6.jpg cat7.jpg cat8.jpg cat9.jpg cat10.jpg ../storage/app/public/images
I cropped every image in square with this online free editor: \ https://pixlr.com/fr/x/
To develop backend the best thing is to add yourself as a user in the User seeder and at to yourself the roles that you want to test. \ To just test some routes without any problem, just add yourself admin role. \ Be carefull about the thing that you always need to have client role to perform any actions.
I recommend you to use PHP Storm from JetBrains: https://www.jetbrains.com/fr-fr/phpstorm/
Second choice is Visual studio, if it is your case, don't forget to install the extension for:
default developement server in on port 80
You can also create an alias for sail command like that:
alias sail='[ -f sail ] && bash sail || bash vendor/bin/sail'
If you want to access to your running container, use following command:
vendor/bin/sail root-shell
As we use HEIG-VD authentication system based on Keycloak, a vue project that will help you in backend development by giving always giving you an available token. To use it, clone the following project and run it: \ https://github.com/heig-fablab/heig-keycloak-auth-token
Just follow the instructions indicated on the repo.
To help at testing API, a collaborative Postman exists, ask Yves Chevallier for the link.
Here is what you need to do to deploy the application.
Go on the frontend project, replace the .env by copying the .env.prod.example:
cp .env .env.save
rm .env
cp .env.prod.example .env
Build the project for production with following command:
npm run build
Copy the dist folder of Vue.js project to the public folder of Laravel. dist folder contains:
Copy the content of the index.html file into the resources/views/app.blade.php file.
Create a new branch from develop.
Push the branch to Github with all the modifications done before.
Create a PR from the release branch to the main and merge it after CI finished.
Connect to HEIG-VD VPN if you are not in HEIG-VD network.
Connect in ssh to the machine, use the following ssh command replacing the
ssh <user>@<hostname>
Go to project folder:
cd /srv/apache2/fablab-manager
Turn off server:
sudo php artisan down
Pull new content:
git pull
If you have some migrations, execute them:
php artisan migrate --path=/database/migrations/full_migration_file_name_migration.php
Turn on server:
sudo php artisan up
For support, send an email at this address: fablab-manager-support