diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 04e683e0be0e5..9995ce874a0fb 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -49,8 +49,22 @@ RUN sed -i 's|/var/www/html|/workspaces/joomla-cms|g' /etc/apache2/sites-availab # Enable Apache's rewrite module and set the ServerName to prevent warnings RUN a2enmod rewrite \ && echo "ServerName localhost" >> /etc/apache2/apache2.conf + +RUN apt-get update && apt-get install -y ssl-cert && \ + a2enmod ssl && \ + a2ensite 000-default && \ + a2ensite default-ssl && \ + sed -i 's|/var/www/html|/workspaces/joomla-cms|g' /etc/apache2/sites-available/default-ssl.conf && \ + echo '\n Options Indexes FollowSymLinks\n AllowOverride All\n Require all granted\n' >> /etc/apache2/sites-available/default-ssl.conf -# Create a custom PHP configuration file to enable file uploads -RUN echo "upload_tmp_dir = /tmp" > /usr/local/etc/php/conf.d/custom-php.ini && \ +# Create a custom PHP configuration file to enable file uploads and a log directory +RUN mkdir -p /var/log/ && \ + touch /var/log/php_errors.log && \ + chown -R www-data:www-data /var/log/ && \ + chmod 766 /var/log/php_errors.log && \ + echo "upload_tmp_dir = /tmp" > /usr/local/etc/php/conf.d/custom-php.ini && \ echo "post_max_size = 64M" >> /usr/local/etc/php/conf.d/custom-php.ini && \ - echo "upload_max_filesize = 64M" >> /usr/local/etc/php/conf.d/custom-php.ini + echo "upload_max_filesize = 64M" >> /usr/local/etc/php/conf.d/custom-php.ini && \ + echo "log_errors = On" >> /usr/local/etc/php/conf.d/custom-php.ini && \ + echo "error_log = /var/log/php_errors.log" >> /usr/local/etc/php/conf.d/custom-php.ini && \ + echo "error_reporting = E_ALL" >> /usr/local/etc/php/conf.d/custom-php.ini diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index ca0037c243cb4..9a93f372e6177 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -7,7 +7,7 @@ "ghcr.io/devcontainers/features/desktop-lite:1": {} }, "portsAttributes": { - "80" : { + "443" : { "label": "Web Server (Joomla & phpmyadmin)", "onAutoForward": "silent" }, diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml index 9135bf1cca7c0..0d47fdd66174a 100644 --- a/.devcontainer/docker-compose.yml +++ b/.devcontainer/docker-compose.yml @@ -8,6 +8,7 @@ services: - ./xdebug.ini:/usr/local/etc/php/conf.d/99-xdebug.ini ports: - "80:80" + - "443:443" - "3306:3306" - "6080:6080" command: sleep infinity diff --git a/.devcontainer/post-create.sh b/.devcontainer/post-create.sh index 0d3024393cd40..370812d5f4157 100644 --- a/.devcontainer/post-create.sh +++ b/.devcontainer/post-create.sh @@ -33,6 +33,7 @@ echo "✅ Dependencies installed." # --- 3. Install Joomla from Repository Source --- echo "--> Installing Joomla using the local repository source..." +rm -f configuration.php php installation/joomla.php install \ --site-name="Joomla CMS Test" \ --admin-user="$ADMIN_REAL_NAME" \ @@ -72,7 +73,7 @@ echo "--> Applying Codespaces URL fix..." cat > "${JOOMLA_ROOT}/fix.php" << 'EOF' > ".git/info/exclude" echo "fix.php" >> ".git/info/exclude" -echo "administrator/fix.php" >> ".git/info/exclude" echo "phpmyadmin" >> ".git/info/exclude" echo "codespace-details.txt" >> ".git/info/exclude" @@ -107,13 +106,12 @@ sed -i \ -e "/cy.task('deleteRelativePath', 'configuration.php');/d" \ -e "/cy.installJoomla(config);/d" \ tests/System/integration/install/Installation.cy.js -sed -i "s/return cy.task('writeRelativeFile', { path: 'configuration.php', content });/return cy.task('writeRelativeFile', { path: 'configuration.php', content, mode: 0o775 });/" tests/System/support/commands/config.mjs # Ensure Cypress is executable and owned by the web server user chmod +x ./node_modules/.bin/cypress cp cypress.config.dist.mjs cypress.config.js npx cypress install -sed -i -e "s|baseUrl:.*|baseUrl: 'http://localhost:80',|" -e "s/db_host: 'localhost'/db_host: 'mysql'/g" -e "s/db_user: 'root'/db_user: 'joomla_ut'/g" -e "s/db_password: ''/db_password: 'joomla_ut'/g" cypress.config.js +sed -i -e "s|baseUrl:.*|baseUrl: 'https://localhost',|" -e "s/db_host: 'localhost'/db_host: 'mysql'/g" -e "s/db_user: 'root'/db_user: 'joomla_ut'/g" -e "s/db_password: ''/db_password: 'joomla_ut'/g" cypress.config.js # Restart Apache to apply all changes echo ' @@ -126,6 +124,7 @@ service apache2 restart echo "--> Applying final group ownership and permissions..." chgrp -R www-data $JOOMLA_ROOT chmod -R g+rws $JOOMLA_ROOT +chown www-data:www-data configuration.php echo "✅ Environment finalized." @@ -140,7 +139,7 @@ DETAILS_FILE="${JOOMLA_ROOT}/codespace-details.txt" echo "This information has been saved to codespace-details.txt" echo "" echo "Joomla Admin Login:" - echo " URL: Open the 'Ports' tab, find the 'Web Server' (80), and click the Globe icon. Then add /administrator" + echo " URL: Open the 'Ports' tab, find the 'Web Server' (443), and click the Globe icon. Then add /administrator" echo " Username: $ADMIN_USER" echo " Password: $ADMIN_PASS" echo ""