Skip to content

Commit 6302ea8

Browse files
authored
First attempt at Codespaces
1 parent 7497996 commit 6302ea8

File tree

7 files changed

+171
-0
lines changed

7 files changed

+171
-0
lines changed

.devcontainer/Dockerfile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Debian version
2+
ARG VARIANT="buster"
3+
FROM mcr.microsoft.com/vscode/devcontainers/base:0-${VARIANT}
4+
5+
# Install PHP
6+
RUN apt-get -y update
7+
RUN apt-get -y install php php-xml php-mbstring php-curl php-zip php-xdebug
8+
9+
# Install Composer
10+
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
11+
12+
# Install MySQL
13+
RUN apt-get -y install mysql-server php-mysql
14+
15+
# Xdebug
16+
ADD resources/xdebug.ini /etc/php/8.1/apache2/conf.d/xdebug.ini
17+
18+
# Configure Apache
19+
RUN echo "Listen 8080" >> /etc/apache2/ports.conf && \
20+
a2enmod rewrite

.devcontainer/devcontainer.json

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
2+
// https://github.com/microsoft/vscode-dev-containers/tree/v0.238.1/containers/ubuntu
3+
{
4+
"name": "Ubuntu",
5+
"build": {
6+
"dockerfile": "Dockerfile",
7+
// Update 'VARIANT' to pick an Ubuntu version: jammy / ubuntu-22.04, focal / ubuntu-20.04, bionic /ubuntu-18.04
8+
// Use ubuntu-22.04 or ubuntu-18.04 on local arm64/Apple Silicon.
9+
"args": { "VARIANT": "ubuntu-22.04" }
10+
},
11+
12+
// Configure tool-specific properties.
13+
"customizations": {
14+
// Configure properties specific to VS Code.
15+
"vscode": {
16+
"settings": {
17+
// Allow Xdebug to listen to requests from remote (or container)
18+
"remote.localPortHost": "allInterfaces"
19+
},
20+
//"devPort": {},
21+
// Specify which VS Code extensions to install (List of IDs)
22+
"extensions": ["xdebug.php-debug"]
23+
}
24+
},
25+
26+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
27+
"forwardPorts": [80, 9003],
28+
29+
// Use 'postCreateCommand' to run commands after the container is created.
30+
"postStartCommand": "bash .devcontainer/resources/setup.sh",
31+
32+
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
33+
"remoteUser": "vscode",
34+
"features": {
35+
"github-cli": "latest"
36+
}
37+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
installer:
2+
admin:
3+
name: admin
4+
password: adminadmin
5+
6+
7+
board:
8+
lang: en
9+
name: My Board
10+
description: My amazing new phpBB board (Titania)
11+
12+
database:
13+
dbms: mysqli
14+
dbhost: 127.0.0.1
15+
dbport: 3306
16+
dbuser: phpbb
17+
dbpasswd: phpbb
18+
dbname: phpbb
19+
table_prefix: phpbb_
20+
21+
email:
22+
enabled: false
23+
smtp_delivery : ~
24+
smtp_host: ~
25+
smtp_port: ~
26+
smtp_auth: ~
27+
smtp_user: ~
28+
smtp_pass: ~
29+
30+
server:
31+
cookie_secure: false
32+
server_protocol: http://
33+
force_server_vars: false
34+
server_name: localhost
35+
server_port: 80
36+
script_path: /
37+
38+
extensions: ['phpbb/titania']

.devcontainer/resources/setup.sh

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Copy Apache configuration
2+
# sudo rm /etc/apache2/sites-enabled/000-default.conf
3+
# sudo cp .devcontainer/resources/phpbb-apache.conf /etc/apache2/sites-enabled/000-default.conf
4+
5+
# Start MySQL
6+
sudo service mysql start
7+
8+
# Start Apache
9+
sudo service apache2 start
10+
11+
# Add SSH key
12+
echo "$SSH_KEY" > /home/vscode/.ssh/id_rsa && chmod 600 /home/vscode/.ssh/id_rsa
13+
14+
# Create a MySQL user to use
15+
sudo mysql -u root<<EOFMYSQL
16+
CREATE USER 'phpbb'@'localhost' IDENTIFIED BY 'phpbb';
17+
GRANT ALL PRIVILEGES ON *.* TO 'phpbb'@'localhost' WITH GRANT OPTION;
18+
CREATE DATABASE IF NOT EXISTS phpbb;
19+
EOFMYSQL
20+
21+
# Download dependencies
22+
echo "Dependencies"
23+
composer install --no-interaction
24+
25+
# Install phpBB
26+
echo "phpBB project"
27+
composer create-project --no-interaction phpbb/phpbb /workspaces/phpbb
28+
29+
# Copy phpBB config
30+
echo "Copy phpBB config"
31+
cp /workspaces/customisation-db/.devcontainer/resources/phpbb-config.yml /workspaces/phpbb/install/install-config.yml
32+
33+
echo "Symlink extension"
34+
sudo rm -rf /var/www/html
35+
sudo ln -s /workspaces/phpbb /var/www/html
36+
mkdir /workspaces/phpbb/ext/phpbb
37+
sudo ln -s /workspaces/customisation-db /workspaces/phpbb/ext/phpbb/titania
38+
39+
echo "phpBB CLI install"
40+
cd /workspaces/phpbb && composer install --no-interaction
41+
sudo php /workspaces/phpbb/install/phpbbcli.php install /workspaces/phpbb/install/install-config.yml
42+
rm -rf /workspaces/phpbb/install
43+
44+
echo "Completed"

.devcontainer/resources/xdebug.ini

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
2+
zend_extension=xdebug.so
3+
4+
[xdebug]
5+
xdebug.mode=develop,debug
6+
xdebug.discover_client_host=1
7+
xdebug.client_port=9003
8+
xdebug.start_with_request=yes
9+
xdebug.log='/var/log/xdebug/xdebug.log'
10+
xdebug.connect_timeout_ms=2000
11+
xdebug.idekey=VSCODE

.vscode/launch.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": "Listen for Xdebug",
9+
"type": "php",
10+
"request": "launch",
11+
"port": 9003,
12+
"pathMappings": {
13+
"/var/www/html/ext/phpbb/titania": "${workspaceRoot}/"
14+
},
15+
"log": true
16+
}
17+
]
18+
}

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"php.debug.ideKey": "VSCODE"
3+
}

0 commit comments

Comments
 (0)