Wordpress with CI/CD using AWS CodePipeline and infrastructure automation (IaC) using Pulumi.
- install AWS CLI and configure it using the access and secret keys of your AWS IAM account
- install pulumi
- install docker and docker compose v2
-
and env vars in a file named
.env
DOCKER_ENV_TARGET=development # development | production AWS_IAM_ACCOUNT_ID="YOUR-AWS_IAM_ACCOUNT_ID" DB_NAME='database_name' DB_USER='database_user' DB_PASSWORD='database_password' DB_HOST='mariadb' REDIS_HOST='redis' REDIS_PORT='6379' WP_ENV=$DOCKER_ENV_TARGET WP_HOME='http://localhost' WP_SITEURL="${WP_HOME}/wp" AUTH_KEY='YOUR_SECRET-AUTH_KEY' SECURE_AUTH_KEY='YOUR_SECRET-SECURE_AUTH_KEY' LOGGED_IN_KEY='YOUR_SECRET-LOGGED_IN_KEY' NONCE_KEY='YOUR_SECRET-NONCE_KEY' AUTH_SALT='YOUR_SECRET-AUTH_SALT' SECURE_AUTH_SALT='YOUR_SECRET-SECURE_AUTH_SALT' LOGGED_IN_SALT='YOUR_SECRET-LOGGED_IN_SALT' NONCE_SALT='YOUR_SECRET-NONCE_SALT'
- NOTE: you can generate [
AUTH_KEY
,SECURE_AUTH_KEY
,LOGGED_IN_KEY
,NONCE_KEY
,AUTH_SALT
,SECURE_AUTH_SALT
,LOGGED_IN_SALT
,NONCE_SALT
] with WordPress salts generator
- NOTE: you can generate [
-
run system locally using docker compose
docker compose up -d
-
stop the system
docker compose down
use
-v
flag to also remove saved volumes
-
generate a github access token from your github account with the following scopes:
repo
workflow
write:repo_hook
read:repo_hook
-
and env vars in a file named
.prod.env
AWS_IAM_ACCOUNT_ID="YOUR-AWS_IAM_ACCOUNT_ID" GITHUB_ACCESS_TOKEN='YOUR-GITHUB_ACCESS_TOKEN' DB_HOST='YOUR-RDS-CLUSTER-URL' DB_NAME='YOUR_RDS_DBNAME' DB_PASSWORD='YOUR_RDS_PASSWORD' DB_USER='YOUR_RDS_PASSWORD' ENV='production' WP_ENV='production' FQDN='http://auto-wp.cloudbits.io' WP_HOME='http://auto-wp.cloudbits.io' WP_SITEURL='http://auto-wp.cloudbits.io/wp' AUTH_KEY='YOUR_SECRET-AUTH_KEY' SECURE_AUTH_KEY='YOUR_SECRET-SECURE_AUTH_KEY' LOGGED_IN_KEY='YOUR_SECRET-LOGGED_IN_KEY' NONCE_KEY='YOUR_SECRET-NONCE_KEY' AUTH_SALT='YOUR_SECRET-AUTH_SALT' SECURE_AUTH_SALT='YOUR_SECRET-SECURE_AUTH_SALT' LOGGED_IN_SALT='YOUR_SECRET-LOGGED_IN_SALT' NONCE_SALT='YOUR_SECRET-NONCE_SALT'
NOTE: replace [
FQDN
,WP_HOME
,WP_SITEURL
] with your own custom subdomain -
replace the
ACCOUNT_ID=665186350589
onbuildspec.yml
to your ownAWS_IAM_ACCOUNT_ID
-
Create or update resources with pulumi
pulumi up
-
Remove all resources with pulumi
pulumi destroy
- the
ap-south-1
AWS region has been used and hard coded throughout the project. you may need to change it according to your needs. - check issues faced during project.
- learn about importing resources from aws console to pulumi.
BSD 3-Clause