1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-10-04 11:41:38 +02:00

[ticket/17544] Support Codespaces on master

PHPBB-17544
This commit is contained in:
battye
2025-09-25 07:45:37 +00:00
parent 2baac73d33
commit 4d020ece1a
7 changed files with 189 additions and 27 deletions

View File

@@ -1,20 +1,22 @@
# 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 && \
a2enmod rewrite
a2enmod rewrite

View File

@@ -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",

View File

@@ -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"]

View File

@@ -0,0 +1,85 @@
# 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
# Add SSH key
# echo "[Codespaces] Add SSH key"
# echo "$SSH_KEY" > /home/vscode/.ssh/id_rsa && chmod 600 /home/vscode/.ssh/id_rsa
# Create a MySQL user to use
echo "[Codespaces] Create MySQL user"
sudo mysql -u root<<EOFMYSQL
CREATE USER 'phpbb'@'localhost' IDENTIFIED BY 'phpbb';
GRANT ALL PRIVILEGES ON *.* TO 'phpbb'@'localhost' WITH GRANT OPTION;
CREATE DATABASE IF NOT EXISTS phpbb;
EOFMYSQL
# Symlink the webroot so it can be viewed
echo "[Codespaces] Create Symlink of webroot"
sudo rm -rf /var/www/html
sudo ln -s /workspaces/phpbb/phpBB /var/www/html
# 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
cp /workspaces/phpbb/.devcontainer/customisations-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
URL_EPV="https://github.com/phpbb/epv"
URL_TV="https://github.com/battye/phpbb-translation-validator"
URL_TITANIA="https://github.com/battye/customisation-db.git"
# Install Titania
echo "[Codespaces] Install Titania"
cd /workspaces/
git clone -b 3.3.x-phpbb-codespaces $URL_TITANIA titania
cd /workspaces/titania
chmod 755 files store
composer install --no-interaction
chmod 755 /workspaces/phpbb/phpBB/ext
mkdir /workspaces/phpbb/phpBB/ext/phpbb
sudo ln -s /workspaces/titania /workspaces/phpbb/phpBB/ext/phpbb/titania
# Install EPV
echo "[Codespaces] Install EPV"
cd /workspaces/
git clone -b master $URL_EPV epv
cd /workspaces/epv
composer install --no-interaction
rm -rf /workspaces/phpbb/phpBB/ext/phpbb/titania/vendor/phpbb/epv
sudo ln -s /workspaces/epv /workspaces/phpbb/phpBB/ext/phpbb/titania/vendor/phpbb/epv
# Install Translation Validator
echo "[Codespaces] Install Translation Validator"
cd /workspaces/
git clone -b master $URL_TV translation-validator
cd /workspaces/translation-validator
composer install --no-interaction
rm -rf /workspaces/phpbb/phpBB/ext/phpbb/titania/vendor/phpbb/translation-validator
sudo ln -s /workspaces/translation-validator /workspaces/phpbb/phpBB/ext/phpbb/titania/vendor/phpbb/translation-validator
# Install phpBB (last so that the extension is auto-installed)
echo "[Codespaces] Run phpBB CLI installation"
cd /workspaces/phpbb/phpBB && composer install --no-interaction
sudo php /workspaces/phpbb/phpBB/install/phpbbcli.php install /tmp/phpbb-config.yml
rm -rf /workspaces/phpbb/phpBB/install
# Set to debug mode
sed -i \
-e "s|@define('PHPBB_ENVIRONMENT', 'production');|@define('PHPBB_ENVIRONMENT', 'development');|" \
-e "s|// *@define('DEBUG_CONTAINER', true);|@define('DEBUG_CONTAINER', true);|" \
/workspaces/phpbb/phpBB/config.php
# Finished
echo "[Codespaces] phpBB (Customisation Team) installation completed"

View File

@@ -0,0 +1,37 @@
// 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": "phpBB (Development Team)",
"build": {
"dockerfile": "../Dockerfile",
"args": {
"VARIANT": "ubuntu-22.04"
}
},
// Configure tool-specific properties.
"customizations": {
// Configure properties specific to VS Code.
"vscode": {
"settings": {
// Allow Xdebug to listen to requests from remote (or container)
"remote.localPortHost": "allInterfaces"
},
//"devPort": {},
// Specify which VS Code extensions to install (List of IDs)
"extensions": ["xdebug.php-debug"]
}
},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [80, 9003],
// Use 'postCreateCommand' to run commands after the container is created.
"postStartCommand": "bash .devcontainer/development-team/setup.sh",
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode",
"features": {
"github-cli": "latest"
}
}

View File

@@ -23,7 +23,6 @@ installer:
smtp_delivery : ~
smtp_host: ~
smtp_port: ~
smtp_auth: ~
smtp_user: ~
smtp_pass: ~

View File

@@ -1,5 +1,6 @@
# setup.sh
# setup.sh - Development Team
# Commands to install and configure phpBB
echo "[Codespaces] Development Team configuration..."
# Start MySQL
echo "[Codespaces] Start MySQL"
@@ -7,11 +8,11 @@ sudo service mysql start
# Start Apache
echo "[Codespaces] Start Apache"
sudo service apache2 start
sudo apache2ctl start
# Add SSH key
echo "[Codespaces] Add SSH key"
echo "$SSH_KEY" > /home/vscode/.ssh/id_rsa && chmod 600 /home/vscode/.ssh/id_rsa
# echo "[Codespaces] Add SSH key"
# echo "$SSH_KEY" > /home/vscode/.ssh/id_rsa && chmod 600 /home/vscode/.ssh/id_rsa
# Create a MySQL user to use
echo "[Codespaces] Create MySQL user"
@@ -22,31 +23,32 @@ sudo mysql -u root<<EOFMYSQL
EOFMYSQL
# Download dependencies
echo "[Codespaces] Install Composer dependencies"
composer install --no-interaction
# echo "[Codespaces] Install Composer dependencies"
# composer install --no-interaction
# Symlink the webroot so it can be viewed
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"