A gateway/firewall task to be able to talk someone about the real job
Fibinger Ádám
2021-10-22 e3c5369dcc89531b88f7abe421f1bf1b6f69d223
commit | author | age
e3c536 1 # SecretServer
2 This is a submission for the Shoprenter's backend developer job.
3
4 Live version: https://secretserver.unr.hu/
5
6 ## Minimum requirements 
7
8 ### Everywhere
9 - PHP 7.2.5 (tested with 7.4)
10 - composer
11
12 ##### Locally
13 - [Symfony binary](https://symfony.com/download)
14 #### On a webserver
15 - 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)
16
17 ### How to fire up the project
18  Included a default .env file with a preconfigured Sqlite database and unless you have a production ready stuff, you should use this default.
19  
20 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.
21
22 ### Install
23 Checkout the repository and change dir (same for local and deployed):
24
25 ```
26 git clone https://shr:yRmglFOqNMbwpnuhP5iy@git.unr.hu/r/shoprenter-secretserver.git secretserver.website.tld
27 cd secretserver.website.tld
28 ```
29
30 This is gonna 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`):
31
32 ```
33 php bin/console doctrine:database:create
34 php bin/console doctrine:migrations:migrate
35 ```
36
37 ##### SELinux
38 In theory if you have good sysadmins, you have SELinux. 
39 Tell them to add `httpd_sys_rw_content_t` type to the project var/* directory and you are good to go.
40
41 ##### Im am alone in the dark and my desire to `setenforce 0` is high
42 _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):
43
44 ```
45 semanage fcontext -a -t httpd_sys_rw_content_t "`pwd`/var(/.*)?"
46 ```
47 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:
48 ```
49 restorecon -R -v "`pwd`/var/"
50 ```
51 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.
52
53 ### Run
54 The .env by default is in debug mode, so if something goes sideways, you should be able to see it.
55
56 #### Locally
57 Fire up this baby:
58 `symfony server:start`
59
60 ### Deploy
61 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