diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 42d94e9963e..4d579223b8d 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -5,7 +5,7 @@ ARG DEBIAN_FRONTEND=noninteractive # PHP RUN apt-get update -y -RUN apt install -y apache2 vim software-properties-common +RUN apt install -y apache2 vim software-properties-common sudo nano RUN add-apt-repository ppa:ondrej/php @@ -42,6 +42,12 @@ RUN apt-get install --no-install-recommends -y \ RUN echo "xdebug.remote_enable = 1" >> /etc/php/8.1/cli/conf.d/20-xdebug.ini RUN echo "xdebug.remote_autostart = 1" >> /etc/php/8.1/cli/conf.d/20-xdebug.ini +# Autostart XDebug for apache +RUN { \ + echo "xdebug.mode=debug"; \ + echo "xdebug.start_with_request=yes"; \ +} >> /etc/php/8.1/apache2/conf.d/20-xdebug.ini + # Docker RUN apt-get -y install \ apt-transport-https \ diff --git a/.devcontainer/codespace.config.php b/.devcontainer/codespace.config.php index 5d883c3c9df..c191698c256 100644 --- a/.devcontainer/codespace.config.php +++ b/.devcontainer/codespace.config.php @@ -16,4 +16,5 @@ $CONFIG = [ if(is_string($codespaceName) && !empty($codespaceName) && is_string($codespaceDomain) && !empty($codespaceDomain)) { $CONFIG['overwritehost'] = $codespaceName . '-80.' . $codespaceDomain; $CONFIG['overwriteprotocol'] = 'https'; + $CONFIG['trusted_domains'] = [ $CONFIG['overwritehost'] ]; } diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index f86a8cf3430..2f197a58fed 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -8,15 +8,18 @@ 8080, 8025 ], - "runArgs": [ - "--privileged" - ], - "extensions": [ - "felixfbecker.php-debug", - "felixfbecker.php-intellisense", - "ms-azuretools.vscode-docker" - ], - "settings": { - "php.suggest.basic": false, - } + "customizations": { + "vscode": { + "extensions": [ + "felixfbecker.php-debug", + "felixfbecker.php-intellisense", + "ms-azuretools.vscode-docker", + "xdebug.php-debug" + ], + "settings": { + "php.suggest.basic": false + } + } + }, + "workspaceFolder": "/var/www/html" } diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml index ffec604fbb6..cb46f3ce800 100644 --- a/.devcontainer/docker-compose.yml +++ b/.devcontainer/docker-compose.yml @@ -6,7 +6,7 @@ services: - .:/workspace:cached - /var/run/docker.sock:/var/run/docker-host.sock - ..:/var/www/html - command: /bin/sh -c "while sleep 1000; do :; done" + command: /bin/sh -c "chown -R www-data:www-data /var/www/html && service apache2 start && while sleep 1000; do :; done" ports: - 80:80 - 8080:8080 diff --git a/.devcontainer/setup.sh b/.devcontainer/setup.sh index 9d2e3d73f98..e3595123b84 100755 --- a/.devcontainer/setup.sh +++ b/.devcontainer/setup.sh @@ -6,3 +6,25 @@ git submodule update --init # Codespace config cp .devcontainer/codespace.config.php config/codespace.config.php + +# Set git safe.directory +git config --global --add safe.directory /var/www/html + +# Onetime installation setup +if [ ! -f "data/.devcontainer-install-complete" ]; then + echo "Running NC installation" + sudo -u www-data php occ maintenance:install \ + --verbose \ + --database=pgsql \ + --database-name=postgres \ + --database-host=127.0.0.1 \ + --database-port=5432 \ + --database-user=postgres \ + --database-pass=postgres \ + --admin-user admin \ + --admin-pass admin && \ + touch "data/.devcontainer-install-complete" +fi + +# Clear caches and stuff ... +service apache2 restart diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 00000000000..8103dd29461 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,14 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "Listen for Xdebug", + "type": "php", + "request": "launch", + "port": 9003 + } + ] +}