Skip to content

Commit

Permalink
merge master
Browse files Browse the repository at this point in the history
  • Loading branch information
Headary committed Jan 6, 2024
2 parents 4994e19 + 64ab12b commit d0c55fa
Show file tree
Hide file tree
Showing 307 changed files with 10,503 additions and 3,668 deletions.
10 changes: 10 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM mcr.microsoft.com/devcontainers/php:0-8.1-bullseye

RUN apt-get update && export DEBIAN_FRONTEND=noninteractive && apt-get -y upgrade \
&& apt-get install -y mariadb-client libxml2-dev libxslt-dev dnsmasq \
&& apt-get clean -y && rm -rf /var/lib/apt/lists/*

RUN docker-php-ext-install mysqli pdo pdo_mysql gettext soap xsl

COPY ./apache-site.conf /etc/apache2/sites-enabled/000-default.conf
RUN sudo a2enmod rewrite proxy proxy_http proxy_balancer lbmethod_byrequests
80 changes: 80 additions & 0 deletions .devcontainer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# Devcontainers jak na to

## Jak používat?

Najděte záložku ports/porty a klikněte na stránku, kterou chcete zobrazit. Pokud to nelze, tak v následujícím seznamu najděte stránku, kterou chcete zobrazit a zapamatujte si port. Následně se připojte na <http://localhost:číslo_portu>. Pokud používáte některé internetové rozhraní, je možné, že se v průběhu přesměrovávání mezi stránkami objeví port na konci adresy, přestože je psán jinde v daném prostředí. V takovém případě port stačí umazat a s trochou štěstí se zde znovu neobjeví.

- 8080: "<http://vyfuk.org>"
- 8081: "<http://online.fyziklani.cz>"
- 8082: "<http://online.fyziklani.org>"
- 8083: "<http://fyziklani.cz>"
- 8084: "<http://fyziklani.org>"
- 8085: "<http://dsef.cz>"
- 8086: "<http://dsef.org>"
- 8087: "<http://fykos.cz>"
- 8088: "<http://fykos.org>"

## Jak zprovoznit lokálně?

Následující návody nejsou úplně otestovány. V případě že si nevíte rady nebo něco nefunguje, tak se nebojte napsat o pomoc. Pokud znáte lepší řešení, tak se také ozvěte.

### linux

1. Nainstalujte docker: Postupujte podle [tohoto návodu (https://docs.docker.com/engine/install/)](https://docs.docker.com/engine/install/) nebo v případě Debian/Ubuntu cca následovně:

``` bash
# Add Docker's official GPG key
sudo apt-get update
sudo apt-get install ca-certificates curl gnupg
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg

# Add the repository to Apt sources (hodí se změnit bookworm za svojí verzi):
echo \
"deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \
"bookworm" stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update

# Install
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
```

2. nainstalujte vscode [https://code.visualstudio.com/download](https://code.visualstudio.com/download)
3. použijte ctrl+shift+p -> Dev Containers: Reopen in Container

Je správně, že se dole na liště bude točit "Configuring Dev Container (show log)", protože postStartCommand spouští webpack, který sleduje změny. Po prvním sestavení assets je možné tento proces ukončit.

### windows

1. Nainstalujte wsl [https://learn.microsoft.com/en-us/windows/wsl/install](https://learn.microsoft.com/en-us/windows/wsl/install)
2. nainstalujte vscode [https://code.visualstudio.com/download](https://code.visualstudio.com/download)
3. Ve wsl nainstalujte Docker (viz. návod pro Linux)
4. Ve wsl nainstalujte a nastavte ssh, tak aby bylo vidět z windows, bez zadání hesla (použitím klíčů).
5. Přidejte následující skript (např jako code.sh)

``` bash
[ -f /var/run/docker.pid ] || sudo /etc/init.d/docker start
if [ ! "$(ps -elf | grep -v grep | grep /usr/sbin/sshd)" ];
then sudo /etc/init.d/ssh start;
fi
filename=$1
parentdir=$(dirname "${filename}")
if [ -d "${filename}" ]; then
codeopenpath=$(cd "${filename}" && pwd)
elif [ -d "${parentdir}" ]; then
codeopenpath=$(cd "${parentdir}" && pwd)/$(basename "${filename}")
fi
cmd.exe /Q /C code --folder-uri vscode-remote://ssh-remote+localhost/$codeopenpath &
tokill=$!
sleep 1
kill $tokill
```

a případně si přidejte alias `alias code='/home/user/.local/bin/startcode.sh` do `.bashrc` nebo `.profile`
6. Do wsl naklonujte tento repositář
7. Ve wsl spustě výše uvedený skrypt/příkaz code + umístění složky kterou chcete otevřít(popřípadě nic pokud chcete otevřít aktuální složku)
8. použijte ctrl+shift+p -> Dev Containers: Reopen in Container
Je správně, že se dole na liště bude točit "Configuring Dev Container (show log)", protože postStartCommand spouští webpack, který sleduje změny. Po prvním sestavení assets je možné tento proces ukončit.
85 changes: 85 additions & 0 deletions .devcontainer/apache-site.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
Listen 8081
Listen 8082
Listen 8083
Listen 8084
Listen 8085
Listen 8086
Listen 8087
Listen 8088

<Directory /workspace>
AllowOverride All
Require all granted
</Directory>

<VirtualHost *:80>
ServerName online.fyziklani.cz.local
ServerAlias online.fyziklani.org.local
DocumentRoot /workspace/www/fol
SetEnv NETTE_DEVEL 1
</VirtualHost>

<VirtualHost *:80>
ServerName fyziklani.cz.local
ServerAlias fyziklani.org.local
DocumentRoot /workspace/www/fof
SetEnv NETTE_DEVEL 1
</VirtualHost>

<VirtualHost *:80>
ServerName dsef.cz.local
ServerAlias dsef.org.local
DocumentRoot /workspace/www/dsef
SetEnv NETTE_DEVEL 1
</VirtualHost>

<VirtualHost *:80>
ServerName fykos.cz.local
ServerAlias fykos.org.local
DocumentRoot /workspace/www/fykos
SetEnv NETTE_DEVEL 1
</VirtualHost>

<VirtualHost *:80>
ServerName vyfuk.org.local
DocumentRoot /workspace/www/vyfuk
SetEnv NETTE_DEVEL 1
</VirtualHost>

PassEnv APACHE_REVERS_ADRESS_8088 APACHE_REVERS_ADRESS_8083 APACHE_REVERS_ADRESS_8082 APACHE_REVERS_ADRESS_8081 APACHE_REVERS_ADRESS_8080 APACHE_REVERS_ADRESS_8087 APACHE_REVERS_ADRESS_8086 APACHE_REVERS_ADRESS_8085 APACHE_REVERS_ADRESS_8084
<VirtualHost *:8080>
ProxyPass "/" "http://vyfuk.org.local/"
ProxyPassReverse "${APACHE_REVERS_ADRESS_8080}" "http://vyfuk.org.local/"
</VirtualHost>
<VirtualHost *:8081>
ProxyPass "/" "http://online.fyziklani.cz.local/"
ProxyPassReverse "${APACHE_REVERS_ADRESS_8081}" "http://online.fyziklani.cz.local/"
</VirtualHost>
<VirtualHost *:8082>
ProxyPass "/" "http://online.fyziklani.org.local/"
ProxyPassReverse "${APACHE_REVERS_ADRESS_8082}" "http://online.fyziklani.org.local/"
</VirtualHost>
<VirtualHost *:8083>
ProxyPass "/" "http://fyziklani.cz.local/"
ProxyPassReverse "${APACHE_REVERS_ADRESS_8083}" "http://fyziklani.cz.local/"
</VirtualHost>
<VirtualHost *:8084>
ProxyPass "/" "http://fyziklani.org.local/"
ProxyPassReverse "${APACHE_REVERS_ADRESS_8084}" "http://fyziklani.org.local/"
</VirtualHost>
<VirtualHost *:8085>
ProxyPass "/" "http://dsef.cz.local/"
ProxyPassReverse "${APACHE_REVERS_ADRESS_8085}" "http://dsef.cz.local/"
</VirtualHost>
<VirtualHost *:8086>
ProxyPass "/" "http://dsef.org.local/"
ProxyPassReverse "${APACHE_REVERS_ADRESS_8086}" "http://dsef.org.local/"
</VirtualHost>
<VirtualHost *:8087>
ProxyPass "/" "http://fykos.cz.local/"
ProxyPassReverse "${APACHE_REVERS_ADRESS_8087}" "http://fykos.cz.local/"
</VirtualHost>
<VirtualHost *:8088>
ProxyPass "/" "http://fykos.org.local/"
ProxyPassReverse "${APACHE_REVERS_ADRESS_8088}" "http://fykos.org.local/"
</VirtualHost>
18 changes: 18 additions & 0 deletions .devcontainer/config.local.neon.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
database:
default:
dsn: 'mysql:host=localhost;dbname=fol-web'
user: %database.user%
password: %database.password%
problems:
dsn: 'mysql:host=localhost;dbname=problems'
user: %database.user%
password: %database.password%
parameters:
fksdbDownloader:
login: a
password: a
url: https:\\example.com
database:
user: a
password: a
gameApiURL: https:\\example.com
73 changes: 73 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/php-mariadb
{
"name": "webs",
"dockerComposeFile": "docker-compose.yml",
"service": "app",
"workspaceFolder": "/workspace",
// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},
// Configure tool-specific properties.
"customizations": {
// Configure properties specific to VS Code.
"vscode": {
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"xdebug.php-pack",
"streetsidesoftware.code-spell-checker-czech",
"streetsidesoftware.code-spell-checker"
]
}
},
// For use with PHP or Apache (e.g.php -S localhost:8080 or apache2ctl start)
"forwardPorts": [
8080,8081,8082,8083,8084,8085,8086,8087,8088
],
"portsAttributes": {
"8080": {
"label": "http://vyfuk.org.local",
"requireLocalPort": true
},
"8081": {
"label": "http://online.fyziklani.cz.local",
"requireLocalPort": true
},
"8082": {
"label": "http://online.fyziklani.org.local",
"requireLocalPort": true
},
"8083": {
"label": "http://fyziklani.cz.local",
"requireLocalPort": true
},
"8084": {
"label": "http://fyziklani.org.local",
"requireLocalPort": true
},
"8085": {
"label": "http://dsef.cz.local",
"requireLocalPort": true
},
"8086": {
"label": "http://dsef.org.local",
"requireLocalPort": true
},
"8087": {
"label": "http://fykos.cz.local",
"requireLocalPort": true
},
"8088": {
"label": "http://fykos.org.local",
"requireLocalPort": true
}
},
"features": {
"ghcr.io/devcontainers/features/git:1": {},
"ghcr.io/devcontainers/features/node:1": {}
},
// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": ".devcontainer/init.sh",
"postStartCommand": ".devcontainer/docker-on-start.sh"
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
51 changes: 51 additions & 0 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
version: '3.8'

services:
app:
build:
context: .
dockerfile: Dockerfile

volumes:
- ..:/workspace:cached

# Overrides default command so things don't shut down after the process ends.
command: sleep infinity

# Runs app on the same network as the database container, allows "forwardPorts" in devcontainer.json function.
#network_mode: service:db

# Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
# user: root

# Use "forwardPorts" in **devcontainer.json** to forward an app port locally.
# (Adding the "ports" property to this file will not forward from a Codespace.)
extra_hosts:
- "vyfuk.org.local:127.0.1.1"
- "online.fyziklani.cz.local:127.0.1.1"
- "online.fyziklani.org.local:127.0.1.1"
- "fyziklani.cz.local:127.0.1.1"
- "fyziklani.org.local:127.0.1.1"
- "dsef.cz.local:127.0.1.1"
- "dsef.org.local:127.0.1.1"
- "fykos.cz.local:127.0.1.1"
- "fykos.org.local:127.0.1.1"


#db:
# image: mysql
# restart: unless-stopped
# volumes:
# - mysql-data:/var/lib/mysql
# environment:
# MYSQL_ROOT_PASSWORD: fksdb
# MYSQL_DATABASE: fksdb
# MYSQL_USER: fksdb
# MYSQL_PASSWORD: fksdb

# Add "forwardPorts": ["3306"] to **devcontainer.json** to forward MariaDB locally.
# (Adding the "ports" property to this file will not forward from a Codespace.)

#volumes:
# mysql-data:
#
24 changes: 24 additions & 0 deletions .devcontainer/docker-on-start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#service apache2 start && npm run dev
if [ "${CODESPACES}" = "true" ]; then
export APACHE_REVERS_ADRESS_8080=https://${CODESPACE_NAME}-8080.${GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN}
export APACHE_REVERS_ADRESS_8081=https://${CODESPACE_NAME}-8081.${GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN}
export APACHE_REVERS_ADRESS_8082=https://${CODESPACE_NAME}-8082.${GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN}
export APACHE_REVERS_ADRESS_8083=https://${CODESPACE_NAME}-8083.${GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN}
export APACHE_REVERS_ADRESS_8084=https://${CODESPACE_NAME}-8084.${GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN}
export APACHE_REVERS_ADRESS_8085=https://${CODESPACE_NAME}-8085.${GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN}
export APACHE_REVERS_ADRESS_8086=https://${CODESPACE_NAME}-8086.${GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN}
export APACHE_REVERS_ADRESS_8087=https://${CODESPACE_NAME}-8087.${GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN}
export APACHE_REVERS_ADRESS_8088=https://${CODESPACE_NAME}-8088.${GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN}
else
export APACHE_REVERS_ADRESS_8080=/
export APACHE_REVERS_ADRESS_8081=/
export APACHE_REVERS_ADRESS_8082=/
export APACHE_REVERS_ADRESS_8083=/
export APACHE_REVERS_ADRESS_8084=/
export APACHE_REVERS_ADRESS_8085=/
export APACHE_REVERS_ADRESS_8086=/
export APACHE_REVERS_ADRESS_8087=/
export APACHE_REVERS_ADRESS_8088=/
fi
apache2ctl start
npm run dev
24 changes: 24 additions & 0 deletions .devcontainer/init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
set -xe

git submodule init && git submodule update
composer install
npm install --no-save
#npm run build

if [ ! -f app/config/config.fof.local.neon ]; then
cp .devcontainer/config.local.neon.example app/config/config.fof.local.neon
fi
if [ ! -f app/config/config.fol.local.neon ]; then
cp .devcontainer/config.local.neon.example app/config/config.fol.local.neon
fi
if [ ! -f app/config/config.dsef.local.neon ]; then
cp .devcontainer/config.local.neon.example app/config/config.dsef.local.neon
fi
if [ ! -f app/config/config.vyfuk.local.neon ]; then
cp .devcontainer/config.local.neon.example app/config/config.vyfuk.local.neon
fi
if [ ! -f app/config/config.fykos.local.neon ]; then
cp .devcontainer/config.local.neon.example app/config/config.fykos.local.neon
fi

rm -rf temp/cache
Loading

0 comments on commit d0c55fa

Please # to comment.