diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index ceb94dc09d..9eaeefdb12 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,19 +1,21 @@ # Debian version -ARG VARIANT="buster" +ARG VARIANT="bookworm" FROM mcr.microsoft.com/vscode/devcontainers/base:0-${VARIANT} # Install PHP +RUN apt-get -y update && apt-get -y install software-properties-common +RUN add-apt-repository ppa:ondrej/php RUN apt-get -y update -RUN apt-get -y install php php-xml php-mbstring php-curl php-zip php-xdebug +RUN apt-get -y install php8.4 php8.4-xml php8.4-mbstring php8.4-curl php8.4-zip php8.4-xdebug # Install Composer RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer # Install MySQL -RUN apt-get -y install mysql-server php-mysql +RUN apt-get -y install mysql-server php8.4-mysql # Xdebug -ADD resources/xdebug.ini /etc/php/8.1/apache2/conf.d/xdebug.ini +ADD resources/xdebug.ini /etc/php/8.4/apache2/conf.d/xdebug.ini # Configure Apache RUN echo "Listen 8080" >> /etc/apache2/ports.conf && \ diff --git a/.devcontainer/devcontainer.json b/.devcontainer/customisations-team/devcontainer.json similarity index 74% rename from .devcontainer/devcontainer.json rename to .devcontainer/customisations-team/devcontainer.json index 7bb0e9cc3a..5a0803656e 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/customisations-team/devcontainer.json @@ -1,12 +1,12 @@ // For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: // https://github.com/microsoft/vscode-dev-containers/tree/v0.238.1/containers/ubuntu { - "name": "Ubuntu", + "name": "phpBB (Customisations Team)", "build": { - "dockerfile": "Dockerfile", - // Update 'VARIANT' to pick an Ubuntu version: jammy / ubuntu-22.04, focal / ubuntu-20.04, bionic /ubuntu-18.04 - // Use ubuntu-22.04 or ubuntu-18.04 on local arm64/Apple Silicon. - "args": { "VARIANT": "ubuntu-22.04" } + "dockerfile": "../Dockerfile", + "args": { + "VARIANT": "ubuntu-22.04" + } }, // Configure tool-specific properties. @@ -27,7 +27,7 @@ "forwardPorts": [80, 9003], // Use 'postCreateCommand' to run commands after the container is created. - "postStartCommand": "bash .devcontainer/resources/setup.sh", + "postStartCommand": "bash .devcontainer/customisations-team/setup.sh", // Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. "remoteUser": "vscode", diff --git a/.devcontainer/customisations-team/phpbb-config.yml b/.devcontainer/customisations-team/phpbb-config.yml new file mode 100644 index 0000000000..1ddc1f4247 --- /dev/null +++ b/.devcontainer/customisations-team/phpbb-config.yml @@ -0,0 +1,37 @@ +installer: + admin: + name: admin + password: adminadmin + email: admin@example.org + + board: + lang: en + name: My Board (with Titania) + description: My amazing new phpBB board (with Titania) + + database: + dbms: mysqli + dbhost: 127.0.0.1 + dbport: 3306 + dbuser: phpbb + dbpasswd: phpbb + dbname: phpbb + table_prefix: phpbb_ + + email: + enabled: false + smtp_delivery : ~ + smtp_host: ~ + smtp_port: ~ + smtp_user: ~ + smtp_pass: ~ + + server: + cookie_secure: false + server_protocol: http:// + force_server_vars: true + server_name: localhost + server_port: 80 + script_path: / + + extensions: ["phpbb/titania"] diff --git a/.devcontainer/customisations-team/setup.sh b/.devcontainer/customisations-team/setup.sh new file mode 100644 index 0000000000..a29d5681b6 --- /dev/null +++ b/.devcontainer/customisations-team/setup.sh @@ -0,0 +1,81 @@ +# setup.sh - Customisations Team +# Commands to install and configure phpBB +echo "[Codespaces] Customisations Team configuration..." + +# Start MySQL +echo "[Codespaces] Start MySQL" +sudo service mysql start + +# Start Apache +echo "[Codespaces] Start Apache" +sudo apache2ctl start + +# Create a MySQL user to use +echo "[Codespaces] Create MySQL user" +sudo mysql -u root< /home/vscode/.ssh/id_rsa && chmod 600 /home/vscode/.ssh/id_rsa +sudo apache2ctl start # Create a MySQL user to use echo "[Codespaces] Create MySQL user" @@ -30,23 +27,24 @@ echo "[Codespaces] Create Symlink of webroot" sudo rm -rf /var/www/html sudo ln -s /workspaces/phpbb/phpBB /var/www/html -# Copy phpBB config -echo "[Codespaces] Copy phpBB configuration" -cp /workspaces/phpbb/.devcontainer/resources/phpbb-config.yml /workspaces/phpbb/phpBB/install/install-config.yml - # Force the server URL to reflect the Codespace # https://docs.github.com/en/codespaces/developing-in-a-codespace/default-environment-variables-for-your-codespace if [ "$CODESPACES" = true ] ; then - echo "[Codespaces] Set the phpBB server name using default environment variables" - codespaces_url="${CODESPACE_NAME}-80.${GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN}" - sed -i "s/localhost/$codespaces_url/g" /workspaces/phpbb/phpBB/install/install-config.yml + cp /workspaces/phpbb/.devcontainer/development-team/phpbb-config.yml /tmp/phpbb-config.yml + CODESPACES_URL="${CODESPACE_NAME}-80.${GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN}" + echo "[Codespaces] Set the phpBB server name using default environment variables: $CODESPACES_URL" + sed -i "s/localhost/$CODESPACES_URL/g" /tmp/phpbb-config.yml fi +# Copy phpBB config +# echo "[Codespaces] Copy phpBB configuration" +# cp /workspaces/phpbb/.devcontainer/resources/phpbb-config.yml /workspaces/phpbb/phpBB/install/install-config.yml + # Install phpBB echo "[Codespaces] Run phpBB CLI installation" cd /workspaces/phpbb/phpBB && composer install --no-interaction -sudo php /workspaces/phpbb/phpBB/install/phpbbcli.php install /workspaces/phpbb/phpBB/install/install-config.yml +sudo php /workspaces/phpbb/phpBB/install/phpbbcli.php install /tmp/phpbb-config.yml rm -rf /workspaces/phpbb/phpBB/install # Finished -echo "[Codespaces] phpBB installation completed" +echo "[Codespaces] phpBB (Development Team) installation completed"