# Mijn-GGZ back-end This is a Laravel project that requires [PHP 7](https://stackoverflow.com/questions/34909101/how-can-i-easily-switch-between-php-versions-on-mac-osx). ## Installation To install this project, first clone the repository to your local machine. Next, navigate into the project directory and run the following command to install the required dependencies: ``` composer install ``` ## Running the Project To run the project, you can use the built-in Laravel development server. Navigate to the project directory in your terminal and run the following command: ``` php artisan serve --port=8000 ``` This will start the server and make the project available at `http://localhost:8000`. You can stop the server at any time by pressing `Ctrl+C` in your terminal. You can visit http://127.0.0.1:8000/api/roles to see if the project is running succesfully. ## Configuration This Laravel project comes with a `.env.example` file that you can use to configure the application. You can create a `.env` file by copying the `.env.example` file: ``` cp .env.example .env ``` In the `.env` file, you can set your database credentials, configure your email settings, and more. Since this project runs in conjunction with [mijn-ggz-frontend](https://github.com/3110-dev/mijnggz-frontend) you will need to specify the location of this environment in the .env file. This is being defined with the property name `APP_URL_FRONTEND` ## Database set-up This project comes with database migrations that you can use to create the necessary database tables. To run the migrations, use the following command: ``` php artisan migrate ``` This will create the required database tables based on the migration files found in the `database/migrations` directory. ## Copying existing database If you have a DB export, that you'd like to use. You can do that with the following command: ``` mysql -u root -p < database_filename.sql ``` ## Testing This project comes with PHPUnit tests that you can run to ensure everything is working as expected. To run the tests, use the following command: ``` php artisan test ``` This will run all the tests found in the `tests/` directory. ## Conclusion That's it! You now know how to install, run, and configure this Laravel project. Happy coding! ## Note Note that the server configuration should refer to `public/index.php`, not `server.php` ## CI/CD Pipeline This repository uses Drone CI for automated testing and deployment: - **Test**: Composer validation and dependency installation - **Deploy to Staging**: Automatic deployment + migrations on push to `main` or `develop` branches - **Deploy to Production**: Manual promotion required + queue restart ### Deployment Servers - **Staging**: 159.223.242.61 → `/var/www/laravel/current` - **Production**: 152.42.148.137 → `/var/www/laravel/current` - **Deployment Script**: `/opt/deploy-scripts/deploy-laravel.sh` Database migrations run automatically during deployment: - **Staging**: `php artisan migrate --force` - **Production**: `php artisan migrate --force` + `php artisan queue:restart` # Drone CI Test - di 2 dec 2025 22:17:12 CET