Guest User

Untitled

a guest
Aug 19th, 2018
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.62 KB | None | 0 0
  1. Installation
  2. --
  3. - clone this repository
  4. - run
  5.  
  6. ```bash
  7. composer install
  8. ```
  9. - edit config file located in root directory (.env). Example:
  10. ```dotenv
  11. mode=dev
  12. db_host=localhost
  13. db_port=3306
  14. db_name=slim
  15. db_user=root
  16. db_password=123456
  17. db_encoding=utf8
  18. ```
  19. - Run migrations (this command will create database tables)
  20.  
  21. ```bash
  22. php vendor/bin/phinx migrate -c migrate.php
  23. ```
  24.  
  25. - run server (dev mode)
  26.  
  27. ```bash
  28. composer start
  29. ```
  30.  
  31. If you use SSL certificate - enable ssl validation in:
  32.  
  33. ```./src/middleware.php```
  34.  
  35. # Using docker
  36.  
  37. - Run container:
  38.  
  39. ```bash
  40. docker-compose up
  41. ```
  42.  
  43. This command will start several containers that includes:
  44. - php-fpm
  45. - nginx
  46. - mysql-server (for this will be created volume called silm_mysql)
  47.  
  48. Apply migrations:
  49.  
  50. docker-compose exec php php vendor/bin/phinx migrate -c migrate.php
  51.  
  52. For run docker containers as daemon add flag ```-d```
  53.  
  54. docker-compose up -d
  55.  
  56. For first time docker-compose will build containers, so it can tool little more time, that in compose up
  57. docker will be use already created containers. To build new containers run docker with flag ```--build```
  58.  
  59. docker-compose up --build
  60.  
  61. - Note: For recreate mysql container you should remove created volume.
  62.  
  63. .env file for local development and .env file for docker containers is separated,
  64. so if you add some specific configuration to docker application, add that config in .docker-env file
  65.  
  66. # Migrations
  67.  
  68. Add new migration:
  69.  
  70. php vendor/bin/phinx create Message -c migrate.php
  71.  
  72. Run migrations:
  73.  
  74. php vendor/bin/phinx migrate -c migrate.php
  75.  
  76. Rollback migrations:
  77.  
  78. php vendor/bin/phinx rollback -c migrate.php
Add Comment
Please, Sign In to add comment