diff --git a/homepage/cwsvJudo/Makefile b/homepage/cwsvJudo/Makefile index b6bcf36..27bd9ff 100644 --- a/homepage/cwsvJudo/Makefile +++ b/homepage/cwsvJudo/Makefile @@ -47,12 +47,12 @@ ampTest: $(ampFiles) .PHONY: INSTALL_DEPENDENCIES INSTALL_DEPENDENCIES: - npm install csso + npm install csso-cli npm install --save-dev --save-exact prettier build/css/cwsvJudo.css: $(cssFiles) mkdir -p $(dir $@) - npx csso --input $^ --output $@ + cat $^ | $(CSSO) -o $@ build/%.php: src/md/%.md build/yaml/%.yaml pandocTemplate/cwsvJudo.html5.pandocTemplate mkdir -p build diff --git a/homepage/cwsvJudo/Makefile.heliohost b/homepage/cwsvJudo/Makefile.heliohost index f20e004..8d33bfc 100644 --- a/homepage/cwsvJudo/Makefile.heliohost +++ b/homepage/cwsvJudo/Makefile.heliohost @@ -26,6 +26,7 @@ clean: # copy/link all together to get a distributable package .PHONY: dist dist: all + rm -r $(distDir) mkdir -p $(distDir) # page data mkdir -p $(distDir)/httpdocs/pages/ @@ -36,26 +37,28 @@ dist: all $(LN) ./phpLib/cwsvJudo $(distDir)/httpdocs/ressourcen/phpLib/cwsvJudo $(LN) ./phpLib/phpqrcode $(distDir)/httpdocs/ressourcen/phpLib/phpqrcode # graphics - mkdir -p $(distDir)/httpdocs/ressourcen/graphiken - $(LN) ./build/graphiken/cwsvJudoLogoWappen $(distDir)/httpdocs/ressourcen/graphiken/logos + mkdir -p $(distDir)/httpdocs/ressourcen/graphiken/logos + $(LN) ./build/graphiken/cwsvJudoLogoWappen/* $(distDir)/httpdocs/ressourcen/graphiken/logos + $(LN) ./graphiken/icons $(distDir)/httpdocs/ressourcen/graphiken/ $(LN) ./graphiken/banner $(distDir)/httpdocs/ressourcen/graphiken/banner $(LN) ./build/graphiken/favIcons/favicon.ico $(distDir)/httpdocs/favicon.ico $(LN) ./res/videos.d $(distDir)/httpdocs/videos.d + $(LN) ./res/IntegrationDurchSport2018.250x.png $(distDir)/httpdocs/ressourcen/graphiken/logos # css mkdir -p $(distDir)/httpdocs/ressourcen/css $(LN) ./build/css/cwsvJudo.css $(distDir)/httpdocs/ressourcen/css/cwsvJudo.css # fonts $(LN) ./res/fonts $(distDir)/httpdocs/ressourcen/fonts # htaccess - $(LN) ./src/htaccess/heliohost/.htaccess $(distDir)/httpdocs/.htaccess -# @todo Link is into the build directory breaking the above pattern. - $(LN) ./src/htaccess/heliohost/pages/responsive/.htaccess ./build/materialize/.htaccess + $(LN) ./src/htaccess/heliohost/.htaccess $(distDir)/httpdocs/.htaccess + $(LN) ./src/htaccess/heliohost/pages/responsive/.htaccess $(distDir)/httpdocs/pages/responsive/.htaccess # config files -# @todo Link is into the build directory breaking the above pattern. - $(LN) ./configs/heliohost/pages.config.inc.php ./build/materialize/config.inc.php + $(LN) ./configs/heliohost/pages.config.inc.php $(distDir)/httpdocs/pages/responsive/config.inc.php # @todo shouldn't be used any more mkdir -p $(distDir)/.local - $(LN) configs/heliohost/db.config.php $(distDir)/.local/db.config.php + $(LN) configs/local/db.config.php $(distDir)/.local/db.config.php + + docker-compose restart # build the materialize version of the page build/materialize/%.php: src/md/%.md build/yaml/%.yaml pandocTemplate/materialize.pandocTemplate diff --git a/homepage/cwsvJudo/PHP.dockerfile b/homepage/cwsvJudo/PHP.dockerfile index 1a9c5cb..7c72276 100644 --- a/homepage/cwsvJudo/PHP.dockerfile +++ b/homepage/cwsvJudo/PHP.dockerfile @@ -1,5 +1,5 @@ # select base image -FROM php:fpm +FROM php:8.2-apache # startup scripts for the image # - docker-php-ext-install -- install helper script from PHP @@ -9,3 +9,5 @@ RUN docker-php-ext-install pdo pdo_mysql # @todo What is pecl? # @todo What is xdebug and how do I use it? RUN pecl install xdebug && docker-php-ext-enable xdebug + +RUN ln /etc/apache2/mods-available/rewrite.load /etc/apache2/mods-enabled/ diff --git a/homepage/cwsvJudo/configs/local/db.config.php b/homepage/cwsvJudo/configs/local/db.config.php new file mode 100644 index 0000000..9c9e7af --- /dev/null +++ b/homepage/cwsvJudo/configs/local/db.config.php @@ -0,0 +1,6 @@ + diff --git a/homepage/cwsvJudo/docker-compose.yaml b/homepage/cwsvJudo/docker-compose.yaml index 2c0d022..e08f502 100644 --- a/homepage/cwsvJudo/docker-compose.yaml +++ b/homepage/cwsvJudo/docker-compose.yaml @@ -1,71 +1,49 @@ -# version for the docker compose file to use -version: "3" - -# a dict of services running in the container label: {} label is a self defined name for the service +version: '3' services: - # the webserver service web: - image: nginx:latest - # port forwarding - ports: - # forward port 80 top port 80 in the container - - "8080:80" - # files and directories to be available in the container - # - localPath:pathInContainer - volumes: - # nginx config file - # - ./nginx.conf:/etc/nginx/conf.d/nginx.conf - # the www-data - # - ./build/dist/heliohost:/home/cwsvjudo/httpdocs - - ./build/dist/heliohost:/usr/share/nginx/html:Z - # php and extensions - php: - # use pre-build image from docker.. - # image: php:fpm - # .. or build your own image + # check the php version you need for your project + # image: php:8.2-apache build: context: . dockerfile: PHP.dockerfile - # files and directories to be available in the container - # @todo Except from better structuring: Is there a reason for not having the volumes as one central list? + ports: + - "8080:80" #this line maps your pc port to the container port + depends_on: + # this line links this container to the db container + - db volumes: - # the www-data - # - ./build/dist/heliohost:/home/cwsvjudo - - ./build/dist/heliohost:/usr/share/nginx/html:ro - # # @todo Maybe use postgre instead? - database: + # this line maps the content of ./html in your pc to the /var/www/html of the container + - ./build/dist/heliohost/httpdocs:/var/www/html + - ./build/dist/heliohost/:/home/cwsvjudo.helioho.st/ + db: + # check the mysql version you need for your project image: mariadb:latest restart: always - # define environment variables - # @todo Should credentials be placed here? Even if it is just a test environment environment: - # MYSQL_TCP_PORT: 1433 MYSQL_USER: "cwsvjudo" MYSQL_DATABASE: "cwsvjudo" MYSQL_ROOT_PASSWORD_FILE: /run/secrets/db_root_password MYSQL_PASSWORD_FILE: /run/secrets/db_password volumes: + # this line maps the content of ./mysql_data in your pc to the /var/lib/mysql of the container - mysqldata:/var/lib/mysql - # initial database - # - has to be created first, e.g., by dumping the database from the productive system - ./cwsvjudo.sql:/docker-entrypoint-initdb.d/cwsvjudo.sql - secrets: - db_root_password - db_password # phpmyadmin - # phpmyadmin: - # image: phpmyadmin:latest - # restart: always - # depends_on: - # - database - # - php - # ports: - # - 8080:80 - # environment: - # # name of the host is the name of the db service started above! Why? I don't know! - # - PMA_HOST=database - # - PMA_PORT=1433 + phpmyadmin: + image: phpmyadmin:latest + restart: always + depends_on: + - db + - web + ports: + - 8081:80 + environment: + # name of the host is the name of the db service started above! Why? I don't know! + - PMA_HOST=db + - PMA_PORT=1433 volumes: # data storage for the db mysqldata: {} @@ -74,4 +52,4 @@ secrets: db_root_password: file: db_root_password.txt db_password: - file: db_password.txt + file: db_password.txt \ No newline at end of file diff --git a/homepage/cwsvJudo/pandocTemplate/materialize.pandocTemplate b/homepage/cwsvJudo/pandocTemplate/materialize.pandocTemplate index 71f8764..3273601 100644 --- a/homepage/cwsvJudo/pandocTemplate/materialize.pandocTemplate +++ b/homepage/cwsvJudo/pandocTemplate/materialize.pandocTemplate @@ -54,7 +54,7 @@ @font-face { font-family: Orbitron-Medium; font-display: fallback; - src: url(/ressourcen/fonts/Orbitron-Medium.otf); + src: url(/ressourcen/fonts/Orbitron-Medium.otf); } diff --git a/homepage/cwsvJudo/phpLib/cwsvJudo/miscAssis.php b/homepage/cwsvJudo/phpLib/cwsvJudo/miscAssis.php index 84fb0df..b146adf 100644 --- a/homepage/cwsvJudo/phpLib/cwsvJudo/miscAssis.php +++ b/homepage/cwsvJudo/phpLib/cwsvJudo/miscAssis.php @@ -61,7 +61,7 @@ return $retKeyValueArray; /// @brief Gibt die URL der gerade aufgerufenen Seite zurück function getCurPagesUrl(){ $pageURL = 'http'; - if ($_SERVER["HTTPS"] == "on"){ + if ($_SERVER["HTTPS"]??null == "on"){ $pageURL .= "s"; } $pageURL .= "://"; @@ -203,8 +203,8 @@ if( empty($someOptions['outCharset']) ) $someOptions['outCharset'] = "UTF-8"; return $ret; } -/** checks if the page is a amp page by checking the reqested url for our amp source */ +/** checks if the page is a amp page by checking the requested url for our amp source */ function check_for_amp_site(){ - return (strpos( $_SERVER['REQUEST_URI'], "pages/amp" ) !== false ); + return (strpos( $_SERVER['REQUEST_URI']??null, "pages/amp" ) !== false ); } ?> diff --git a/homepage/cwsvJudo/src/htaccess/heliohost/.htaccess b/homepage/cwsvJudo/src/htaccess/heliohost/.htaccess index f3014d4..b6eabde 100644 --- a/homepage/cwsvJudo/src/htaccess/heliohost/.htaccess +++ b/homepage/cwsvJudo/src/htaccess/heliohost/.htaccess @@ -1,3 +1,14 @@ +# Auf die Fontdatei wird von der Subdomain aus zugegriffen +# - das gesamte ressourcenVerzeichnis wird auf die Maindomain umgeleitet +# - die mainDomain erlaubt aber anscheinend nicht, das fremde domains bei ihr anfragen startet +# - deshalb zumindest für das otf-File den cross domain zugriff erlauben +# (seltsam, dass der Zugriff auf die Bilder unter Photoalben aber erlaubt wird...) + + + Header set Access-Control-Allow-Origin "*" + + + # Url-Rewriting aktivieren RewriteEngine on