diff --git a/.env.example b/.env.example new file mode 100644 index 00000000..9bf6fac5 --- /dev/null +++ b/.env.example @@ -0,0 +1,8 @@ +WORDPRESS_DB_HOST=host.docker.internal:3307 +WORDPRESS_DB_USER=dbuser +WORDPRESS_DB_PASSWORD=dbpassword +WORDPRESS_DB_NAME=dbname +WORDPRESS_TABLE_PREFIX=wp_ +WP_DEBUG=true +SITE_URL=http://localhost:8080 + diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 00000000..6bdb9870 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,23 @@ +## Description + +Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change. + +Fixes # (issue) + +## Type of change + +Please delete options that are not relevant. + +- [ ] Bug fix (non-breaking change which fixes an issue) +- [ ] New feature (non-breaking change which adds functionality) +- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) +- [ ] This change requires a documentation update + +## Screenshots + +## Checklist: + +- [ ] My code follows the style guidelines of this project +- [ ] I have performed a self-review of my own code +- [ ] I have commented my code, particularly in hard-to-understand areas +- [ ] I have made corresponding changes to the documentation \ No newline at end of file diff --git a/.github/workflows/deploy-to-dev.yml b/.github/workflows/deploy-to-dev.yml new file mode 100644 index 00000000..a5882831 --- /dev/null +++ b/.github/workflows/deploy-to-dev.yml @@ -0,0 +1,18 @@ +name: Deploy to WP Engine +on: + push: + branches: + - main +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: GitHub Action Deploy to WP Engine + uses: wpengine/github-action-wpe-site-deploy@v3 + with: + WPE_SSHG_KEY_PRIVATE: ${{ secrets.WPE_SSHG_KEY_PRIVATE }} + WPE_ENV: academyafridev + SRC_PATH: "wp-content/" + REMOTE_PATH: "wp-content/" + FLAGS: -azvr --inplace --exclude=".*" --exclude=wp-content/mu-plugins/ diff --git a/.gitignore b/.gitignore index 2bcb9608..3f9c8036 100644 --- a/.gitignore +++ b/.gitignore @@ -61,20 +61,9 @@ wp-content/mu-plugins/wpe-wp-sign-on-plugin* /xmlrpc.php /wp-admin /wp-includes -/wp-content/themes/twentyten -/wp-content/themes/boss -/wp-content/themes/boss-child -/wp-content/themes/twentyeleven -/wp-content/themes/twentytwelve -/wp-content/themes/twentythirteen -/wp-content/themes/twentyfourteen -/wp-content/themes/twentyfifteen -/wp-content/themes/twentysixteen -/wp-content/themes/twentyseventeen -/wp-content/themes/twentyeighteen -/wp-content/themes/twentynineteen -/wp-content/themes/twentytwenty -/wp-content/plugins/akismet* +/wp-content/themes/* +!/wp-content/themes/academyAfrica +!/wp-content/themes/hello-elementor /wp-content/plugins/* !/wp-content/plugins/index.php /wp-content/mu-plugins @@ -84,6 +73,7 @@ apple-touch-icon.png favicon.ico wpe-deploy-status-academyafrica robots.txt +wordpress # large/disallowed file types # a CDN should be used for these @@ -118,4 +108,6 @@ robots.txt *.asx *.asf *.wmv -*.avi \ No newline at end of file +*.avi + +.env diff --git a/README.md b/README.md new file mode 100644 index 00000000..5b2188a8 --- /dev/null +++ b/README.md @@ -0,0 +1,50 @@ +### Repository Setup Guide + +1. **Add SSH Key to WP Engine** + + To get started, add your SSH key to WP Engine. For more information, refer to the [WP Engine SSH Gateway Documentation](https://wpengine.com/support/ssh-gateway/). + +2. **Create a Working Directory and Clone the Repository** + + Create a working directory and clone this repository into it. + +3. **Download and Restore Backups from WP Engine** + + Download and restore the latest backups from WP Engine using the instructions provided in the [WP Engine Restore Documentation](https://wpengine.com/support/restore/). Unzip the backups into your working directory. + +4. **Access the Remote Database Using SSH** + + Use SSH and local port forwarding to access the remote database. Here's an example command: + + ```bash + ssh -L 3307:127.0.0.1:3306 -i ~/.ssh/wpengine_ed25519 -o IdentitiesOnly=yes sacademyafrica@sacademyafrica.ssh.wpengine.net + ``` + + For more details, refer to the [WP Engine Remote Database Access Guide](https://wpengine.com/support/setting-remote-database-access/). + +5. **Update Environment Variables** + + Update the environment variables in the `.env` file using the database credentials from WP Engine. You can find the credentials with the following command once you have SSH access to the remote database: + + ```bash + grep WPENGINE_SESSION_DB_PASSWORD ./sites/environmentname/_wpeprivate/config.json + ``` + + To access the admin dashboard from localhost, add the following to `wp-config.php` in the `wordpress` directory after the `WP_DEBUG` line: + + ```php + define( 'WP_SITEURL', 'http://localhost:8080' ); + define( 'WP_HOME', 'http://localhost:8080' ); + ``` + +6. **Start Containers** + + Run the following command to start the containers using Docker Compose: + + ```bash + docker-compose up -d + ``` + +7. **Access the Site** + + You can now access the site at [http://localhost:8080](http://localhost:8080). \ No newline at end of file diff --git a/contrib/docker-compose/nginx/nginx.conf b/contrib/docker-compose/nginx/nginx.conf new file mode 100644 index 00000000..55b5be5e --- /dev/null +++ b/contrib/docker-compose/nginx/nginx.conf @@ -0,0 +1,49 @@ +server { + listen 80; + listen [::]:80; + + server_name localhost; + ## Your only path reference. + root /var/www/html; + + index index.php; + + location = /favicon.ico { + log_not_found off; + access_log off; + } + + location = /robots.txt { + allow all; + log_not_found off; + access_log off; + } + + location / { + # include the "?$args" part so non-default permalinks doesn't break when using query string + try_files $uri $uri/ /index.php?$args; + } + + location ~ \.php$ { + #NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini\ + try_files $uri =404; + fastcgi_split_path_info ^(.+\.php)(/.+)$; + fastcgi_pass wordpress:9000; + fastcgi_index index.php; + include fastcgi_params; + fastcgi_intercept_errors on; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_param PATH_INFO $fastcgi_path_info; + fastcgi_read_timeout 600; + } + client_max_body_size 100M; + + location ~ /\.ht { + deny all; + } + + location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ { + expires max; + log_not_found off; + } +} diff --git a/contrib/docker-compose/php/uploads.ini b/contrib/docker-compose/php/uploads.ini new file mode 100644 index 00000000..1169da3d --- /dev/null +++ b/contrib/docker-compose/php/uploads.ini @@ -0,0 +1,3 @@ +upload_max_filesize = 128M +post_max_size = 128M +max_execution_time = 600 diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..d5d6b1e5 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,20 @@ +version: '3.9' + +services: + wordpress: + image: wordpress:6.3.2 + restart: unless-stopped + env_file: .env + ports: + - 8080:80 + environment: + WORDPRESS_CONFIG_EXTRA: | + define( 'WP_SITEURL', '${SITE_URL}' ); + define( 'WP_HOME', '${SITE_URL}' ); + define( 'WP_DEBUG', ${WP_DEBUG} ); + volumes: + - ./wordpress:/var/www/html + - ./wp-content/themes:/var/www/html/wp-content/themes + - ./wp-content/plugins:/var/www/html/wp-content/plugins + - ./contrib/docker-compose/php/uploads.ini:/usr/local/etc/php/conf.d/uploads.ini +