diff --git a/README.md b/README.md index 741bb04..9ac1f3b 100644 --- a/README.md +++ b/README.md @@ -7,14 +7,104 @@ The goal of this project is to develop a web application which manages the devic - device add - Device History -## Installation (WIP) -- +## Installation + +### Requirements +#### Docker +##### 1. Download and install docker engine +Follow the instructions on the official [docker website](https://docs.docker.com/engine/install/) +##### 2. Add docker to your startup +```sh +sudo systemctl enable docker --now +``` +##### 3. Add your current user to the docker group +```sh +sudo usermod -aG docker $USER +``` +> `$USER` stands for the current logged in user +##### 4. Restart your computer + +#### Composer +##### Download and install composer +Follow the instructions on the official [composer website](https://getcomposer.org/download/) or install it via apt package repository: +```sh +sudo apt-get install composer +``` +Make sure you have these php extensions installed: + - php-curl + - php-xml + +### Geting started +#### 1. Clone the repository +```sh +git clone https://git.uni-regensburg.de/ase22ws/abschlussprojekt-device-manager-timon-lorenz.git +``` +#### 2. Go in the project directory +```sh +cd device-app +``` +#### 3. Install dependencies +Install dependencies [source](https://medium.com/@colorfield/install-an-existing-laravel-project-c6e6bf28d5c6) +```sh +composer install +composer dumpautoload -o +``` +If you are facing some issues try to update it first and run `composer install` afterwards again +```sh +composer update +``` +Make sure you have the mentioned php extensions installed + +#### 4. Setup the Environement +Copy the .env.example file and create .env file +```sh +cp .env.example .env +``` +#### 5. Start the project for the first time +This could take a few moments for the first time, later on it only takes a few seconds +```sh +vendor/bin/sail up +``` +#### 6. Generate a key +Open a new terminal in the project directory and enter the following command while project is still running: +```sh +vendor/bin/sail exec laravel.test php artisan key:generate +``` +#### 7. Setup the database +To migrate the database use following command: +```sh +sail exec laravel.test php artisan migrate +``` +If you want to use some random generated sample as well as two users an admin and a test user you have to use the `seed` function +```sh +sail exec laravel.test php artisan migrate:refresh --seed +``` +#### 8. View the project +Open your browser and go to `http://localhost` and try it out. If you are finished you can stop the `vendor/bin/sail up` terminal via 'strg' + 'C'. + +### General +#### Troubleshooting +If you followed the eight steps correctly the project should work. If you have any trouble installing the project, please let me know or make a issue. +#### Bash Alias +If you want save some time you can create a shortcut to `vendor/bin/sail` and only use `sail` +##### 1. Open bashrc +Go to your home directory and run +```sh +nano .bashrc +``` +##### 2. Add shortcut +Add following line: +```sh +alias sail='[ -f sail ] && bash sail || bash vendor/bin/sail' +``` + + ## Usage (WIP) - User story ## Author (WIP) -- only me +Timon Lorenz (lot17014) ## License (WIP) propably MIT @@ -28,11 +118,6 @@ Laravel is a full feature framework ### security coss-side-scripting disabled -## Database setup - -### Data seed -sail exec laravel.test php artisan migrate:refresh --seed - ## ChatGPT see ChatGPT folder diff --git a/device-app/.env.example b/device-app/.env.example index a4ae39d..0f7b7da 100644 --- a/device-app/.env.example +++ b/device-app/.env.example @@ -9,7 +9,7 @@ LOG_DEPRECATIONS_CHANNEL=null LOG_LEVEL=debug DB_CONNECTION=mysql -DB_HOST=0.0.0.0 +DB_HOST=mysql DB_PORT=3306 DB_DATABASE=device_app DB_USERNAME=sail