This repo contains the code of the website !
To run the project, you must :
You need to create a .env
file in the src
directory based on the .env.example
file.
💡 When you code you should switch the
APP_DEBUG
totrue
to see the errors.
cp .env.example src/.env
You can now start Docker and follow the laravel sail documentation more specifically the installation part.
🐬 During the installation, you will be asked to choose the database you want to use. You must choose
mysql
for the database.
Once the installation is done you can run the following command to start the project :
📁Move to the
src
directory
Run this command to start the docker of the project
./vendor/bin/sail up -d #-d to detach the process, you can create an alias for sail later
Once the docker is running, access the docker container with the following command (replace <container_name>
with the name of the container (not the db container, the one with the website code).
docker exec -it <container_name> /bin/bash
Once you are in the container, you can run the following commands to finish the installation ::
#Run these in the docker container
npm update
cd /var/www/html
composer update
php artisan cache:clear
composer dump-autoload
php artisan key:generate
chmod -R 777 storage/
php artisan migrate:refresh --seed
php artisan queue:work
You can now access the website at localhost:80.
You may encounter some issues while installing the project. Here are some common issues and their solutions :
- On command composer require laravel/sail --dev during sail installation: error message saying
maatwebsite/excel[3.1.0, ..., 3.1.25] require php ^7.0 -> your php version (8.1.2) does not satisfy that requirement.
- Fix: ignore the system requirements with
composer require laravel/sail --dev --ignore-platform-reqs
instead of the original command
- After launch, the tabs "Network graph", "Field management > Fields" and "User profile" aren't working and return an exception:
The /var/www/html/bootstrap/cache directory must be present and writable.
- Fix: change the permissions on the cache directory:
chmod -R 770 bootstrap/cache/
If you encounter any other issues, please raise an issue on the repository with the error message and the steps you followed.
You can go to https://portainer.netw4ppl.tech to manage the docker server but also your machine locally, providing you the ability to register your machine.
To do so:
- Connect to the portainer space with the credentials present in the keepass
- Go to Environments.
- Add an environment
- Choose Edge Agent and enter a name, choose the group Local Machine and leave the other parameters as default
- Click on Add environment.
Depending on your configuration, choose the right deployment script. For mac and wsl, it is possible to choose Linux and docker standalone.
- Copy the script and run it on your machine.
- Finish by clicking on Update environment.
You should find your machine in Home.
- Clone the github project
- With portainer, create a new stack.
- Choose custom template and choose the n4p-website template
- Adapt the compose according to the deployment environment
IMPORTANT :
It is necessary to add the environment variables which define the identifiers of the database.
Your must correctly create and associate the volumes (you can create theses directories wherever you want, as long as you associate them correctly in the docker compose)
/var/N4P/sql-volume
: to store the data of the database/var/www/website/
: path to the website source code (if cloned from github, be careful to point to thesrc
folder)/srv/www/web_apps/website/ssl
:⚠️ Not necessary if ssl is not required/etc/apache2/sites-available/docker_config.conf
points to an apache configuration file (see below)
# conf/vhost.conf
<VirtualHost *:80>
DocumentRoot /var/www/html/public
<Directory "/var/www/html">
AllowOverride all
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
# Delete the lines below if you don't use ssl
<IfModule mod_ssl.c>
<VirtualHost *:443>
DocumentRoot /var/www/html/public
<Directory "/var/www/html">
AllowOverride all
Require all granted
</Directory>
SSLCertificateFile /var/imported/ssl/fullchain.pem
SSLCertificateKeyFile /var/imported/ssl/privkey.pem
SSLEngine on
</VirtualHost>
</IfModule>
- Deploy the stack
- Make sure there is a
.env
file in your source directory. This file is required by Laravel to run the project
You can use the following template paying particular attention to the following elements:
APP_DEBUG
: if true, Laravel displays error log (only use it in dev mode)DB_HOST
: if you use docker, you have to put the sql docker container's nameDB_DATABASE
: the name of the DB you had defined in the docker composer environment (step 2)DB_USERNAME
: the username you had defined in the docker composer environment (step 2)DB_PASSWORD
: the password you had defined in the docker composer environment (step 2)DEFAULT_EMAIL
: the email for the default accountDEFAULT_PASSWORD
: the password for the default accountDEFAULT_TEAM
: the default team
APP_NAME=Laravel
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=
LOG_CHANNEL=stack
LOG_LEVEL=debug
DB_CONNECTION=mysql
DB_HOST=sql_container_name
DB_PORT=3306
DB_DATABASE='database_name'
DB_USERNAME=USER
DB_PASSWORD='PASSWORD'
BROADCAST_DRIVER=log
CACHE_DRIVER=file
QUEUE_CONNECTION=sync
SESSION_DRIVER=database
SESSION_LIFETIME=120
MEMCACHED_HOST=127.0.0.1
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_MAILER=smtp
MAIL_HOST=mailhog
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS=null
MAIL_FROM_NAME="${APP_NAME}"
DEFAULT_EMAIL="default user email"
DEFAULT_PASSWORD="default user password"
DEFAULT_TEAM="default user team"
TRANSLATION_API_URL="ENTER THE URL"
TRANSLATION_API_TOKEN="YOUR API TOKEN"
- Run the following commands :
npm update
cd /var/www/html
composer update
php artisan cache:clear
composer dump-autoload
php artisan key:generate
chmod -R 777 storage/
php artisan migrate:refresh --seed
- We recommend using PHPStorm as IDE
This configuration works if you have set up the project with sail.
- Go to
Run > Edit Configurations
- Add a new cli configuration
- …