Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set up development environment #1

Open
wants to merge 33 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
0088d16
Set up themes
koechkevin Oct 13, 2023
0fc6e1d
- Set up development environment with docker
koechkevin Oct 13, 2023
afd370e
Format .env example file
kelvinkipruto Oct 13, 2023
9ac851d
Add php uploads.ini file
kelvinkipruto Oct 13, 2023
afe0305
Add basic readme
kelvinkipruto Oct 13, 2023
4b7349c
Merge branch 'feature/setup-development-environment' into ft/readme
kelvinkipruto Oct 13, 2023
72d9dbd
Update readme with admin access doc
kelvinkipruto Oct 13, 2023
205b962
Reviewed changes
kelvinkipruto Oct 13, 2023
91a5beb
Merge branch 'feature/setup-development-environment' into ft/readme
kelvinkipruto Oct 13, 2023
cd2128f
Fix admin styles not working
kelvinkipruto Oct 13, 2023
69859c5
Merge branch 'feature/setup-development-environment' into ft/readme
kelvinkipruto Oct 13, 2023
001152d
Add new line
koechkevin Oct 16, 2023
127db9e
Update environment variables
kelvinkipruto Oct 16, 2023
1ea4c46
Fix nginx timeouts
kelvinkipruto Oct 16, 2023
3b852d8
Update wordpress version
kelvinkipruto Oct 16, 2023
a5776b7
Remove dockerfile
kelvinkipruto Oct 16, 2023
1eac71a
Deploy to dev via workflow actions
koechkevin Oct 26, 2023
c7049f6
Debug deploy
koechkevin Oct 26, 2023
2876c26
change remote path
koechkevin Oct 26, 2023
bf9c8a1
Test deploy
koechkevin Oct 26, 2023
efb30d4
Deploy yo dev
koechkevin Oct 26, 2023
10a437c
Test deploy
koechkevin Oct 26, 2023
5a88b77
Set up development environment
koechkevin Oct 26, 2023
61bf553
Remove test file
koechkevin Oct 26, 2023
294cc07
Deploy to dev env
koechkevin Oct 26, 2023
0437169
Deploy to dev
koechkevin Oct 26, 2023
52a8d7f
Delete removed files
koechkevin Oct 26, 2023
aa05150
Add gitignore files
koechkevin Oct 26, 2023
a7fcaaa
Add delete option
koechkevin Oct 26, 2023
91cdac5
Deploy plugins only
koechkevin Oct 26, 2023
0829bed
Set to main branch
koechkevin Oct 26, 2023
02a0b09
Ignore files
koechkevin Oct 26, 2023
8a5adf5
Add a pull request template
koechkevin Oct 26, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -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

23 changes: 23 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -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
18 changes: 18 additions & 0 deletions .github/workflows/deploy-to-dev.yml
Original file line number Diff line number Diff line change
@@ -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/
22 changes: 7 additions & 15 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -118,4 +108,6 @@ robots.txt
*.asx
*.asf
*.wmv
*.avi
*.avi

.env
50 changes: 50 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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 [email protected]
```

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).
49 changes: 49 additions & 0 deletions contrib/docker-compose/nginx/nginx.conf
Original file line number Diff line number Diff line change
@@ -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;
}
}
3 changes: 3 additions & 0 deletions contrib/docker-compose/php/uploads.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
upload_max_filesize = 128M
post_max_size = 128M
max_execution_time = 600
20 changes: 20 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -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