|
1 | | -# BSA 2019 Thread backend |
| 1 | +# BSA 2019 Thread (backend) |
| 2 | + |
| 3 | +## Technologies |
| 4 | + |
| 5 | +* PHP 7.2 || 7.3 |
| 6 | +* [Laravel 5.8](https://laravel.com) |
| 7 | +* [Docker](https://www.docker.com/) |
| 8 | +* [Docker-compose](https://docs.docker.com/compose/) |
| 9 | +* [Beanstalkd](https://github.com/beanstalkd/beanstalkd) - message queue (очередь сообщений для обработки тяжелых задач асинхронно) |
| 10 | +* [REST API](https://ru.wikipedia.org/wiki/REST) |
| 11 | +* [CORS](https://developer.mozilla.org/ru/docs/Web/HTTP/CORS) |
| 12 | +* [JWT](https://ru.wikipedia.org/wiki/JSON_Web_Token) tokens |
| 13 | +* Websockets and [Pusher](https://pusher.com/) service |
2 | 14 |
|
3 | 15 | ## Install |
| 16 | + |
| 17 | +Set your .env vars: |
| 18 | +```bash |
| 19 | +cp .env.example .env |
| 20 | +``` |
| 21 | + |
| 22 | +### Launch local environment: |
| 23 | + |
| 24 | +Step inside project directory |
| 25 | +```bash |
| 26 | +cd <project_dir>/backend |
| 27 | +``` |
| 28 | + |
| 29 | +Start application docker containers: |
| 30 | +``` bash |
| 31 | +docker-compose up -d |
| 32 | +``` |
| 33 | + |
| 34 | +Install composer dependencies and generate app key: |
| 35 | +```bash |
| 36 | +docker exec -it thread-app composer install |
| 37 | +docker exec -it thread-app php artisan key:generate |
| 38 | +``` |
| 39 | + |
| 40 | +Database migrations install (set proper .env vars) |
| 41 | +```bash |
| 42 | +docker exec -it thread-app php artisan migrate |
| 43 | +docker exec -it thread-app php artisan db:seed |
| 44 | +``` |
| 45 | + |
| 46 | +Generate jwt key and create link to public folder for file uploads (you should have `FILESYSTEM_DRIVER=public` in .env): |
| 47 | +```bash |
| 48 | +docker exec -it thread-app php artisan jwt:generate |
| 49 | +docker exec -it thread-app php artisan storage:link |
| 50 | +``` |
| 51 | + |
| 52 | +Application server should be ready on http://localhost:<APP_PORT> |
| 53 | + |
| 54 | +Pusher websocket server install: |
| 55 | +* Create an account and application on [pusher.com](https://pusher.com/) and copy your credentials to your .env. |
| 56 | +* Launch beanstalkd queue listening to messages by `docker exec -it thread-app php artisan queue:work` |
0 commit comments