You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
6. Spuštěný docker compose v terminálu lze ukončit pomocí CTRL+C
52
+
53
+
### Následný vývoj
54
+
55
+
Po prvotním nastavení stačí opakovat kroky 3--6 ze sekce první nastavení. Není
56
+
tedy třeba pokaždé spouštět script `setup.sh`.
57
+
58
+
Pokud chcete, aby vám weby běžely nepřetržitě a nemuseli jste mít otevřený
59
+
terminál, ve je docker spuštěn, lze pomocí `docker compose up -d` ve složce
60
+
`docker` spustit kontejnery na pozadí. Následně je lze zastavit přes
61
+
`docker compose stop`.
62
+
63
+
Více informací o tom, jak používat docker a jak v něm spouštět příkazy
64
+
naleznete v [Docker README](docker/README.md).
65
+
66
+
## Manuální instalace
67
+
68
+
Script `setup.sh` provádí úkony, které by bylo nutné udělat jinak ručně. Jedná
69
+
se o:
70
+
71
+
- ve složce `app/config/` zkopírování konfiguračního souboru `config.local.neon.sample` do složky `local` pod názvy `fykos.neon`, `vyfuk.neon`, `fol.neon`, `fof.neon`, `dsef.neon`
72
+
- zkopíruje soubor `docker/docker-compose.yml.sample` do `docker/docker-compose.yml` a vyplní `UID` a `GID` uživatele
73
+
- buildne kontejnery přes `docker compose build`
74
+
- pomocí vytvořeného kontejneru nainstaluje balíčky pro composer a npm a spustí `npm run build`
75
+
76
+
## Development using podman
13
77
14
78
As a convenience for `podman` based setups, you can use [just](https://just.systems/)
15
79
command runner for your development environment. For `docker` see below. All
@@ -27,148 +91,3 @@ To use `docker` instead of `podman`, instead of `just cmd` write `just runner=do
27
91
This is untested, so contact @rkuklik if you run into issues.
28
92
29
93
To access the websites (after running `just dev`), following links can be used:
30
-
31
-
-[vyfuk](http://localhost:8080)
32
-
-[fykos](http://localhost:8081)
33
-
-[fol](http://localhost:8082)
34
-
-[fof](http://localhost:8083)
35
-
-[dsef](http://localhost:8084)
36
-
37
-
## Installation
38
-
39
-
1. Clone the repository `git clone --recurse-submodules ...`
40
-
2. Configure the web server (see below for example configuration)
41
-
3. Create a configuration files and fill all the necessary information
Do not forget to modify your `/etc/hosts` file to point to the correct IP address of your server.
85
-
```etc/hosts
86
-
127.0.0.1 online.fyziklani.cz.local
87
-
127.0.0.1 online.fyziklani.org.local
88
-
127.0.0.1 fyziklani.cz.local
89
-
127.0.0.1 fyziklani.org.local
90
-
127.0.0.1 dsef.cz.local
91
-
127.0.0.1 dsef.org.local
92
-
127.0.0.1 fykos.cz.local
93
-
127.0.0.1 fykos.org.local
94
-
```
95
-
96
-
These domains need to be configured in `app/config/config.*.local.neon` under `parameters.domains` in order to work.
97
-
98
-
## Build instructions
99
-
100
-
*You need `composer` and `npm` with `node` to build this project.*
101
-
102
-
1. Run `composer install` to install php dependencies.
103
-
2. Run `npm install` to install javascript dependencies and build tools.
104
-
3. Run `npm run build` to compile css and js files.
105
-
106
-
You can use `npm run dev` to automatically rebuild files when they are changed.
107
-
108
-
## Detailed manual for WSL, Ubuntu
109
-
110
-
Installing Prerequisites
111
-
1. open wsl
112
-
2. if not installed, install `apache2` (`sudo apt install apache2`)
113
-
3. if not installed, install `php8.1` (`sudo apt install php8.1`, you might also need `php8.1-dom` and `php8.1-soap`)
114
-
4. if not installed, install `mysql` (google how to do that - e.g. via `sudo apt install mysql-server`)
115
-
5. if not installed, install `composer` (google how to do that - sudo apt install composer does not work as of July 2022)
116
-
6. if not installed, install `node`, version at least 16. Alternatively, install nvm and then `nvm use 16`
117
-
7. if not installed, install `gettext` (via `sudo apt install gettext`), check `locale -a` if you have `cs_CZ` and `en_US` installed, otherwise use `sudo locale-gen cs_CZ`, `sudo locale-gen cs_CZ.UTF-8` and then `sudo update-locale`
118
-
8. pull this repository to a location where you want to have it (e.g. `cd C:/data/fykos && git pull <repourl>`)
119
-
* Note: you may encounter various problems, e.g. php not being executed (try `sudo apt install libapache2-mod-php` and `sudo a2enmod php8.1`) or with "ERROR: Module mpm_event is enabled" (try `sudo a2dismod mpm_event` and `sudo a2enmod mpm_prefork`, and then `sudo service apache2 restart`)
120
-
121
-
Configuring Apache
122
-
* Explanation: the webserver reads all files from `sites-enabled` and loads the configuration from them.
123
-
Other files in these directories are symlinks which point to files in `sites-available` (handy for turning off
124
-
the page by deleting the symlink without deleting the actual configuration)
125
-
1. open wsl
126
-
2. create a new file `sudo nano /etc/apache2/sites-enabled/fykos-webs.conf`
127
-
3. paste the example apache configuration (above) into this file
128
-
4. change the Directory and all DocumentRoots to be where you have downloaded your repo (e.g. `<Directory /mnt/c/data/fykos/webs>` and `DocumentRoot /mnt/c/data/fykos/webs/www/fol`)
129
-
4. save it
130
-
131
-
Configuring hosts file
132
-
* Explanation: Since wsl has its own IP adress, and we use a browser over on Windows, we need
133
-
to configure Windows's DNS to route us over to wsl.
134
-
1. open the file `C:/Windows/System32/drivers/etc/hosts` as administrator
135
-
2. paste the example contents of `/etc/hosts` and save
136
-
3. open wsl and type `ip a` and find out the IP adress of WSL (usually something like eth0: ... *inet 172.22.207.240/20* ...)
137
-
4. replace all occurrences of `127.0.0.1` in `C:/Windows/System32/drivers/etc/hosts` with the found IP (e.g. `172.22.207.240`)
138
-
5. Sadly, steps 3 and 4 need to be repeated everytime wsl gets restarted, because a new IP is generated every time.
139
-
140
-
141
-
Configuring MySql
142
-
* Explanation: some parts of the web need an access to a database to work.
143
-
1. open wsl
144
-
2. start mysql (`sudo mysql`). You may encounter errors, in which case google how to solve them.
145
-
3. you are now in mysql shell (the line starts with `mysql>`).
146
-
4. Create databases for FOL and FOF: (a) `create database fol ;` (b) `create database fof ;`
147
-
5. Create user with a password, e.g.: `CREATE USER 'fykos'@'localhost' IDENTIFIED BY 'password';`
148
-
6. Set privileges for the newly created user: (a) `GRANT ALL PRIVILEGES ON fol.* TO 'fykos'@'localhost' WITH GRANT OPTION;` (b) same, only with fof
149
-
7. Close mysql by ctrl+D
150
-
151
-
152
-
Inserting tables and data
153
-
* Explanation: In FOL, we the database also needs to have some tables and preferably dummy data.
154
-
1. open wsl terminal and `sudo mysql`
155
-
2. type `use fol` (tells mysql to modify the `fol` database)
156
-
3. copy and paste the contents of the file `data/sql/schema_fol.sql` into mysql shell and press Enter (creates tables)
157
-
4. copy and paste the contents of the file `data/sql/example_fol.sql` into mysql shell and press Enter (inserts data)
158
-
159
-
160
-
Configuring neon files
161
-
* Explanation: these files contain secret data such as passwords and connection strings.
162
-
It is something like appsettings.json. These data are then used in the application to
163
-
connect to various resources, such as the database.
164
-
*`.local` files always override the configurations from files without the `.local`. We only
165
-
edit the `.local` files, which are intentionally excluded from git.
166
-
1. tell somebody to send you at least the `fksdbDownloader` credentials and fill them out
167
-
2. fill out the database name in the connection strings (e.g. `dsn: 'mysql:host=localhost;dbname=fof'`)
168
-
3. fill out the `parameters.database` section with the credentials that you've used in MySql (`user: fykos`, `password: password`)
169
-
4. set gameApiURL to an empty string: `gameApiURL: ''`
170
-
171
-
172
-
## Troubleshooting
173
-
174
-
* "could not find driver" ... if this error is shown `Nette\Database\ConnectionException could not find driver Caused by PDOException`, it is likely because you do not have something installed, see https://stackoverflow.com/questions/2852748/pdoexception-could-not-find-driver
0 commit comments