# SecretServer This is a submission for the Shoprenter's backend developer job. Live version: https://secretserver.unr.hu/ ## Minimum requirements ### Everywhere - PHP 7.2.5 (tested with 7.4) - composer ##### Locally - [Symfony binary](https://symfony.com/download) #### On a webserver - A properly configured php 7+ and some VHost-config skills on your webserver of choice (It is on an Nginx + php-fpm on the live version) ### How to fire up the project Included a default .env file with a preconfigured Sqlite database and unless you have a production ready stuff, you should use this default. If you want to use anything else, please consult the [Symfony Documentation](https://symfony.com/doc/current/configuration.html#configuring-environment-variables-in-env-files) about the correct configuration. ### Install Checkout the repository and change dir (same for local and deployed): ``` git clone https://shr:yRmglFOqNMbwpnuhP5iy@git.unr.hu/r/shoprenter-secretserver.git secretserver.website.tld cd secretserver.website.tld composer install --no-dev ``` This is will create an Sqlite DB (or anything else if you changed the config) with the correct schema (you can check the .env file about the details) in the project dir (`var/data.db`): ``` php bin/console doctrine:database:create php bin/console doctrine:migrations:migrate ``` ##### SELinux In theory if you have good sysadmins, you have SELinux. Tell them to add `httpd_sys_rw_content_t` type to the project var/* directory and you are good to go. ##### Im am alone in the dark and my desire to `setenforce 0` is high _Never turn off_ SELinux if you have it, its easy: let the almighty SERuler know we have some stuff that should be R/W by the webserver (you have to be in the project directory): ``` semanage fcontext -a -t httpd_sys_rw_content_t "`pwd`/var(/.*)?" ``` At this point you have a proper type context enabled on the var files (if your OS has correctly configured context), but SELinux cannot see it yet, you have to "activate" it: ``` restorecon -R -v "`pwd`/var/" ``` You should see the context you modified on the files, the app is able to function now. This is a permanent change, it sticks (reloads) even after a restart. ### Run The .env by default is in debug mode, so if something goes sideways, you should be able to see it. #### Locally Fire up this baby: ``` symfony server:start ``` ### Deploy Only God knows what you are using (Apache, Nginx, Windows Server), you can configure as a normal symfony project: https://symfony.com/doc/current/setup/web_server_configuration.html ## Testing ### Installing dev libraries If you followed point-by-point your version of the project does not contains dev libraries, you have to install it: ``` composer install ``` And get the tests running: ``` php bin/phpunit ``` Probably you will get some errors, most likely the recent removal of monolog from default Symfony install. My only option would be to mask up, but I prefer not to: https://github.com/liip/LiipTestFixturesBundle/issues/135 ### Questions Are welcome @ (vfiber@gmail.com)[mailto:vfiber@gmail.com] / (adam.fibinger@gmail.com)[mailto:adam.fibinger@gmail.com]