Skip to content

Commit

Permalink
Merge pull request #43 from pifou25/fix/xdebug
Browse files Browse the repository at this point in the history
fix: remove php8. report previous various fixes from feature
  • Loading branch information
pifou25 authored May 11, 2024
2 parents 680b0bc + 604d691 commit b64cd0b
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 49 deletions.
32 changes: 14 additions & 18 deletions .github/workflows/buildx-platform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@ on:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true


env:
# used to download jeedom source
JEEDOM_REPO: "pifou25/jeedom-core"


jobs:
initStep:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -41,10 +46,11 @@ jobs:
fail-fast: false
matrix:
debian: [buster, bullseye, bookworm]
php: [7.3, 8.0, 8.2]
php: [7.3, 8.2]
# linux/amd64,linux/amd64/v2,linux/amd64/v3,linux/arm64,linux/riscv64,linux/ppc64le,linux/s390x,linux/386,linux/mips64le,linux/mips64,linux/arm/v7,linux/arm/v6
platform: [amd64, arm64, arm/v6, arm/v7]
jeedom: ["V4-stable", "beta"]
# no beta version for now
jeedom: ["V4-stable"]
target: ["light", "full"]
xdebug: [true, false]
exclude:
Expand All @@ -55,16 +61,10 @@ jobs:
- debian: "buster"
xdebug: false
# exclude php version for each debian
- debian: buster
php: 8.0
- debian: buster
php: 8.2
- debian: bullseye
php: 8.2
- debian: bookworm
php: 7.3
- debian: bookworm
php: 8.0

env:
REGISTRY_IMAGE: pifou25/jeedom
Expand Down Expand Up @@ -148,7 +148,7 @@ jobs:
build-args: |
DEBIAN=${{ matrix.debian }}
PHP=${{ matrix.php }}
JEEDOM_REPO=pifou25/jeedom-core
JEEDOM_REPO=${{ env.JEEDOM_REPO }}
JEEDOM_VERSION=${{ matrix.jeedom }}
XDEBUG=${{ matrix.xdebug }}
platforms: linux/${{ matrix.platform }}
Expand All @@ -164,6 +164,7 @@ jobs:
echo "${{ matrix.debian }} PHP${{ matrix.php }} ${{ matrix.target }} branch ${{ matrix.jeedom }} debug ${{ matrix.xdebug }} has Errors! 🚀" >> $GITHUB_STEP_SUMMARY
echo "Cache: buildx-${{ runner.os }}-${{ matrix.platform }}-${{ matrix.debian }} hit? ${{ steps.cache.outputs.cache-hit }}"
echo "Labels: ${{ steps.meta.outputs.labels }}" >> $GITHUB_STEP_SUMMARY
exit 1
-
name: Export digest ${{ env.TAG_NAME }}:${{ matrix.platform }}
Expand Down Expand Up @@ -200,8 +201,9 @@ jobs:
max-parallel: 2
matrix:
debian: [buster, bullseye, bookworm]
php: [7.3, 8.0, 8.2]
jeedom: ["V4-stable", "beta"]
php: [7.3, 8.2]
# no beta version for now
jeedom: ["V4-stable"]
target: ["light", "full"]
xdebug: [true, false]
exclude:
Expand All @@ -212,16 +214,10 @@ jobs:
- debian: "buster"
xdebug: false
# exclude php version for each debian
- debian: buster
php: 8.0
- debian: buster
php: 8.2
- debian: bullseye
php: 8.2
- debian: bookworm
php: 7.3
- debian: bookworm
php: 8.0

env:
REGISTRY_IMAGE: pifou25/jeedom
Expand Down
31 changes: 14 additions & 17 deletions build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ LABEL org.opencontainers.image.authors pifou25

ARG JEEDOM_VERSION=V4-stable
ENV JEEDOM_VERSION=${JEEDOM_VERSION}
ARG WEBSERVER_HOME=/var/www/html
ENV WEBSERVER_HOME=${WEBSERVER_HOME}
ENV MYSQL_JEEDOM_DATABASE=jeedom
ENV MYSQL_JEEDOM_USER=jeedom
# ENV MYSQL_JEEDOM_PASSWD
Expand All @@ -66,7 +64,7 @@ LABEL org.opencontainers.image.description "Jeedom Home Automation in Docker. ${
COPY motd /etc/jmotd
ADD https://raw.githubusercontent.com/${JEEDOM_REPO}/${JEEDOM_VERSION}/install/bashrc /root/.bashrc
# Use bash as the default shell - replace ln -sf /bin/bash /bin/sh && \
SHELL ["/bin/bash", "-c"]
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# shellcheck disable=SC2016
RUN echo '[ ! -z "$TERM" -a -r /etc/motd ] && cat /etc/issue && cat /etc/motd && cat /etc/jmotd' \

Check failure on line 69 in build/Dockerfile

View workflow job for this annotation

GitHub Actions / initStep

SC2016 info: Expressions don't expand in single quotes, use double quotes for that.
>> /etc/bash.bashrc && \
Expand Down Expand Up @@ -116,14 +114,10 @@ RUN install-php-extensions\
mbstring mysqli pcntl pdo_mysql \
soap sockets xmlrpc zip gd opcache ssh2

# change doc root apache configuration
RUN sed -ri -e "s!/var/www/html!${WEBSERVER_HOME}!g" /etc/apache2/sites-available/*.conf && \
sed -ri -e "s!/var/www/!${WEBSERVER_HOME}!g" /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf

WORKDIR ${WEBSERVER_HOME}
VOLUME ${WEBSERVER_HOME}
WORKDIR /var/www/html
VOLUME /var/www/html
# copy PHP sources from previous stage
COPY --from=vendor app/ ${WEBSERVER_HOME}
COPY --from=vendor app/ .

# Change uid and gid of apache to docker user uid/gid - create /tmp/jeedom
RUN usermod -u 1000 www-data \
Expand All @@ -132,8 +126,8 @@ RUN usermod -u 1000 www-data \
&& chmod 777 -R /tmp/jeedom \
&& chown www-data:www-data -R /tmp/jeedom

VOLUME ${WEBSERVER_HOME}/backup
VOLUME ${WEBSERVER_HOME}/log
VOLUME /var/www/html/backup
VOLUME /var/www/html/log

# install xdebug : check compatibility https://xdebug.org/docs/compat
COPY xdebug.ini /tmp/xdebug.ini
Expand All @@ -144,8 +138,12 @@ RUN if [[ ${XDEBUG} == "true" ]] ; then \
&& mv /tmp/xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini ; \
fi


#
# First final image: light Jeedom with /without xdebug
#
FROM base as light_jeedom
# the mysql hostname is another environment variable
ENV MYSQL_HOST=db

# Healthcheck for the 'light' image, just check if apache is running
Expand All @@ -155,7 +153,9 @@ COPY --chmod=0775 init.sh /root/init.sh
CMD ["/root/init.sh"]


#
# Second final image: full standalone
#
FROM base as full_jeedom
ARG JEEDOM_REPO
# localhost didn't work for mysql, should try 127.0.0.1
Expand All @@ -165,7 +165,7 @@ ENV MYSQL_HOST=localhost
RUN groupadd -r mysql && useradd -r -g mysql mysql

RUN mkdir -p '/var/run/mysqld' && \
chown root:mysql '/var/run/mysqld' && \
chown www-data:mysql '/var/run/mysqld' && \
chmod 774 '/var/run/mysqld'

RUN apt-get update && apt-get install --no-install-recommends --no-install-suggests -q -y \

Check failure on line 171 in build/Dockerfile

View workflow job for this annotation

GitHub Actions / initStep

DL3008 warning: Pin versions in apt get install. Instead of `apt-get install <package>` use `apt-get install <package>=<version>`
Expand All @@ -184,12 +184,9 @@ ADD https://raw.githubusercontent.com/${JEEDOM_REPO}/${JEEDOM_VERSION}/install/
ADD https://raw.githubusercontent.com/${JEEDOM_REPO}/${JEEDOM_VERSION}/install/fail2ban.jeedom.conf /etc/fail2ban/jail.d/jeedom.conf
COPY php.ini /usr/local/etc/php/php.ini

RUN sed -i -e "s%WEBSERVER_HOME%${WEBSERVER_HOME}%g" /etc/apache2/conf-available/security.conf && \
sed -i -e "s%WEBSERVER_HOME%${WEBSERVER_HOME}%g" /etc/apache2/conf-available/remoteip.conf && \
rm /etc/apache2/conf-enabled/security.conf > /dev/null 2>&1 && \
RUN rm /etc/apache2/conf-enabled/security.conf > /dev/null 2>&1 && \
ln -s /etc/apache2/conf-available/security.conf /etc/apache2/conf-enabled/ && \
ln -s /etc/apache2/conf-available/remoteip.conf /etc/apache2/conf-enabled/ && \
sed -i -e "s%WEBSERVER_HOME%${WEBSERVER_HOME}%g" /etc/apache2/sites-available/000-default.conf && \
rm /etc/apache2/sites-enabled/000-default.conf > /dev/null 2>&1 && \
ln -s /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-enabled/ && \
rm /etc/apache2/conf-available/other-vhosts-access-log.conf > /dev/null 2>&1 && \
Expand Down
2 changes: 1 addition & 1 deletion build/php.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1045,7 +1045,7 @@ cli_server.color = On
[Pdo_mysql]
; Default socket name for local MySQL connects. If empty, uses the built-in
; MySQL defaults.
pdo_mysql.default_socket=
pdo_mysql.default_socket=/var/run/mysqld/mysqld.sock

[Phar]
; http://php.net/phar.readonly
Expand Down
5 changes: 3 additions & 2 deletions build/standalone/healthcheck.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash

set -e

Expand All @@ -8,7 +8,8 @@ healthcheck() {
return 1
fi
# check that all managed process are running
if ! supervisorctl status | grep RUNNING; then
RUNNING=$(supervisorctl status | grep RUNNING | wc -l)
if [[ $RUNNING -ne 5 ]] ; then
return 1
fi
return 0
Expand Down
26 changes: 16 additions & 10 deletions build/standalone/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,34 +66,39 @@ if [ ! -f "${WEBSERVER_HOME}/core/config/common.config.php" ]; then

log_info "first run of jeedom container : configuration"
cp ${WEBSERVER_HOME}/core/config/common.config.sample.php ${WEBSERVER_HOME}/core/config/common.config.php
sed -i "s/'host'/'unix_socket'/g" ${WEBSERVER_HOME}/core/config/common.config.php
sed -i "s/#PASSWORD#/${MYSQL_JEEDOM_PASSWD}/g" ${WEBSERVER_HOME}/core/config/common.config.php
sed -i "s/#DBNAME#/${MYSQL_JEEDOM_DATABASE}/g" ${WEBSERVER_HOME}/core/config/common.config.php
sed -i "s/#USERNAME#/${MYSQL_JEEDOM_USER}/g" ${WEBSERVER_HOME}/core/config/common.config.php
sed -i "s/#PORT#/3306/g" ${WEBSERVER_HOME}/core/config/common.config.php
sed -i "s/#HOST#/\/run\/mysqld\/mysqld.sock/g" ${WEBSERVER_HOME}/core/config/common.config.php

sed -i "s/#HOST#/${MYSQL_HOST}/g" ${WEBSERVER_HOME}/core/config/common.config.php
# changes for mysql socket instead of tcp for local use
# sed -i "s/'host'/'unix_socket'/g" ${WEBSERVER_HOME}/core/config/common.config.php
# sed -i "s/#HOST#/\/run\/mysqld\/mysqld.sock/g" ${WEBSERVER_HOME}/core/config/common.config.php


chmod 770 -R ${WEBSERVER_HOME}
chown -R www-data:www-data ${WEBSERVER_HOME}
mkdir -p /tmp/jeedom
chmod 770 -R /tmp/jeedom
chown www-data:www-data -R /tmp/jeedom

# start database
supervisorctl start mysql

# wait until db is up and running
while ! mysqladmin ping -h"$MYSQL_HOST" --silent; do
log_warn "Wait 2 seconds for MariaDB to start..."
sleep 2
done

log_info " ___ Création de la database SQL ${MYSQL_JEEDOM_DATABASE} pour '${MYSQL_JEEDOM_USER}'@'${MYSQL_HOST}' ... ___"
mysql_sql "DROP USER IF EXISTS '${MYSQL_JEEDOM_USER}'@'${MYSQL_HOST}';"
mysql_sql "CREATE USER '${MYSQL_JEEDOM_USER}'@'${MYSQL_HOST}' IDENTIFIED BY '${MYSQL_JEEDOM_PASSWD}';"
mysql_sql "DROP DATABASE IF EXISTS ${MYSQL_JEEDOM_DATABASE};"
mysql_sql "CREATE DATABASE ${MYSQL_JEEDOM_DATABASE};"
mysql_sql "GRANT ALL PRIVILEGES ON ${MYSQL_JEEDOM_DATABASE}.* TO '${MYSQL_JEEDOM_USER}'@'${MYSQL_HOST}';"
mysql_sql "DROP USER IF EXISTS '${MYSQL_JEEDOM_USER}'@'*';"
mysql_sql "CREATE USER '${MYSQL_JEEDOM_USER}'@'*' IDENTIFIED BY '${MYSQL_JEEDOM_PASSWD}';"
mysql_sql "GRANT ALL PRIVILEGES ON ${MYSQL_JEEDOM_DATABASE}.* TO '${MYSQL_JEEDOM_USER}'@'*';"
# user for @localhost
mysql_sql "DROP USER IF EXISTS '${MYSQL_JEEDOM_USER}'@'localhost';"
mysql_sql "CREATE USER '${MYSQL_JEEDOM_USER}'@'localhost' IDENTIFIED BY '${MYSQL_JEEDOM_PASSWD}';"
mysql_sql "GRANT ALL PRIVILEGES ON ${MYSQL_JEEDOM_DATABASE}.* TO '${MYSQL_JEEDOM_USER}'@'localhost';"


log_info "jeedom clean install"
php ${WEBSERVER_HOME}/install/install.php mode=force
Expand Down Expand Up @@ -134,7 +139,8 @@ if [ ! -f "${WEBSERVER_HOME}/core/config/common.config.php" ]; then

fi

sysctl vm.swappiness=10
# does NOT work inside docker container!
# sysctl vm.swappiness=10

a2dismod status
a2enmod headers
Expand Down
2 changes: 1 addition & 1 deletion build/standalone/supervisord.conf
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ stderr_logfile_maxbytes=0
[program:mysql]
command=mysqld_safe
user=mysql
autostart=false
autostart=true
autorestart=true
startsecs=5
killasgroup=true
Expand Down

0 comments on commit b64cd0b

Please sign in to comment.