Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 4 additions & 0 deletions .cz.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
commitizen:
name: cz_conventional_commits
tag_format: $version
version: 0.0.1
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
.DS_Store
site/
.vscode
7 changes: 7 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
repos:
- hooks:
- id: commitizen
stages:
- commit-msg
repo: https://github.com/commitizen-tools/commitizen
rev: v2.23.0
109 changes: 109 additions & 0 deletions docs/archive/AWS CDK/AWS CDK Resources.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
# WordPress AWS CDK Config using TDD
## Details/prerequisites
* Using typescript
* AWS Account
* AWS CLI
* Visual Studio Code
* DevContainer for CodeSpaces/Docker based development on Raspberry PI
* Node.js - We use the latest lts version installed

## Setup
* Install the AWS CDK
* `nom install -g aws-cdk` - Global install of the cod
* Bootstrap the AWS CDK - Creates the S3 bucket for your AWS account
* Get your account details
* `aws sts get-caller-identity --profile default` - Will show your account credentials
```
{
"UserId": "AIDABCDEFPAYBY3IXXXXX",
"Account": "7804444519999",
"Arn": "arn:aws:iam::640532519999:user/nziswanodeveloper"
}
```
* Get your default region
* `aws configure get region --profile default`
* Response: `eu-central-1`
* Bootstrap your CDK stack
`cdk bootstrap aws://78044451999/eu-central-1`
## Create the app
* Create a new repository in GitHub
* Name: aws_wordpress_cdk
* **Do not include a README or a .gitignore file. CDK will not run in a non-empty directory**
* Checkout the repository locally
* `git clone git@github.com:Nziswano/aws_wordpress_cdk.git`
* `nvm use --lts` - make sure we're using the latest lts version
* `cdk init app --language typescript` - Create the CDK app
* In the cloned folder
* Add *.nvmrc* file. Which version of node we're going to be using
* `echo "lts/*" >> .nvmrc `
* Add *.devcontainer* folder. CodeSpaces/Docker container for our environment
* `cp -r ../holding_folder/.devcontainer .`
* Helpful Commands
```
## Useful commands

* `npm run build` compile typescript to js
* `npm run watch` watch for changes and compile
* `npm run test` perform the jest unit tests
* `cdk deploy` deploy this stack to your default AWS account/region
* `cdk diff` compare deployed stack with current state
* `cdk synth` emits the synthesized CloudFormation template
```
* Build your initial stack `npm run build`
* Verify that it worked `cdk ls` - should show your stack
* Add/update your *README.md* file
* Commit and push to GitHub.
## Building our App
### AWS Registry configuration
* API Documentation: https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ecr-readme.html
* `git checkout -b aws_ecr_config`
* Update our *README.md* file
#### Our first stack
* `lib/aws_wordpress_cdk-stack.ts`
```typescript
import * as cdk from 'aws-cdk-lib';
import { Stack, StackProps } from 'aws-cdk-lib';
import * as ecr from 'aws-cdk-lib/aws-ecr';
import { Construct } from 'constructs';

export class AwsWordpressCdkStack extends Stack {
constructor(scope: Construct, id: string, props?: StackProps) {
super(scope, id, props);

const ecr_repo = new ecr.Repository(this, 'WordpressDockerRegistry', {
repositoryName: 'wordpress-cms-ecr',
});
}
}
```
##### Our Test
* File: `test/aws_wordpress_cdk.test.ts`
```typescript
import * as cdk from 'aws-cdk-lib';
import { Template } from 'aws-cdk-lib/assertions';
import * as AwsWordpressCdk from '../lib/aws_wordpress_cdk-stack';

test('WordPress Registry Created', () => {
const app = new cdk.App();
const stack = new AwsWordpressCdk.AwsWordpressCdkStack(app, 'MyTestStack');
const template = Template.fromStack(stack);

template.hasResourceProperties('AWS::ECR::Repository', {
RepositoryName: 'wordpress-cms-ecr'
});
});

```
* To run tests: `npm run build && cdk synth && npm run test`
#### GitHub Actions for continues integration/deployment
* Github Actions
* https://github.com/marketplace/actions/aws-cdk-github-actions

* Environment variables - Actions secrets
* DEV_AWS_ACCESS_KEY_ID
* DEV_AWS_SECRET_ACCESS_KEY
* DEV_AWS_REGION
Available to private repositories
* Setup the local environment
* Build and test
* Run the deployment
54 changes: 54 additions & 0 deletions docs/archive/AWS CDK/SetupWordpressViaCDKArticle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Setup AWS CDK
## Resources
* https://github.com/projen/projen - project generator. Includes generators for CDK
* Test Resources:
* https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.assertions-readme.html
* https://axelhodler.medium.com/tests-for-aws-cdk-code-9a4bce9fec0e
* [Fargate with EFS and Aurora Serverless using AWS CDK](https://blog.codecentric.de/en/2021/03/fargate-with-efs-and-aurora-serverless-using-aws-cdk/)
* WordPress with Aurora and Elastic File System
* [Building an image searching solution with the AWS CDK](https://aws.amazon.com/blogs/compute/building-an-image-searching-solution-with-the-aws-cdk/)
* [How to create an RDS Aurora serverless instance with CDK](https://dev.to/cjjenkinson/how-to-create-an-aurora-serverless-rds-instance-on-aws-with-cdk-5bb0)
## Tutorials
* [AWS CDK v2 Tutorial – How to Create a Three-Tier Serverless Application](https://www.freecodecamp.org/news/aws-cdk-v2-three-tier-serverless-application/)
* [Testing the Async Cloud with AWS CDK](https://dev.to/aws-builders/testing-the-async-cloud-with-aws-cdk-33aj)
## Details
* [Aspects](https://docs.aws.amazon.com/cdk/v2/guide/aspects.html)
## CDK Documentation
* [ConstructHub](https://constructs.dev)
* [CDK Patterns](https://cdkpatterns.com)
* [AWS CDK API Reference](https://docs.aws.amazon.com/cdk/api/v2//docs/aws-cdk-lib.aws_ecr-readme.html)
## Setup AWS CLI environment with correct keys
* `aws configure`
* Need:
* AWS Access Key
* AWS Secret Access Key
* Default Region name: eu-central-1
* Default output format: json
## Setup CDK environment
* `npm install -g aws-cdk`
* `cdk bootstrap`
* Be sure to import cdk `import * as cdk from 'aws-cdk-lib';`
* `cdk synth` -> `cdk deploy`
* Make changes
* `cdk diff` -> `cdk deploy`
* `cdk destroy`
## GitHub Actions
* https://github.com/marketplace/actions/aws-cdk-github-actions
* https://github.com/marketplace/actions/aws-cdk-action
* https://github.com/aws-actions

## Setup constructs

### ECR
### SSM Parameters
### Aurora Serverless MySQL
* Resources
* https://bobbyhadz.com/blog/aws-cdk-rds-example
#### Secrets Manager
* [How to create an RDS Aurora serverless instance with CDK](https://dev.to/cjjenkinson/how-to-create-an-aurora-serverless-rds-instance-on-aws-with-cdk-5bb0)
#### VPC
### API Gateway
### Fargate

Can destroy one stack at a time
* `cdk destroy CmsCdkStack`
17 changes: 17 additions & 0 deletions docs/archive/Headless RaspBerry Pi Development Server.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Headless RaspBerry Pi Development Server
## Setup for headless development
* Ubuntu 64 bit operating system
* SSH
* OhMyZsh
* Git
* Docker
* NodeJS
* Raspberry Pi
## C# Development
* Tools
* Visual Studio Code
* Remote development
* Devcontainer
* Docker
* NodeJS
## Wordpress Development
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
title: Google Firebase and WordPress
updated: 2020-09-10 21:43:38Z
created: 2020-09-10 21:43:38Z
---

# Google Firebase and WordPress
Yes, it's technically possible to host a WordPress site on Google Firebase hosting using the WordPress REST API. Google Firebase is a family of services, mostly geared towards mobile development, but includes a very generous hosting allowance for static sites. When building my new personal site, I wanted to build a static site but also have a blog. Looked at some static blog engines but didn't feel like rebuilding the site everytime I create new content. Decided to use WordPress' REST API since I already had a WordPress multi-site running on an Amazon LightSail Server.
I decided to use Google Firebase hosting because I'm spending a fair amount of time in South Africa and wanted my site to have relative low latency from Johannesburg or New York City. Although Amazon has CloudFront, they don't have any local points of presence in South Africa but Google does. That, plus the cost (or lack of it), was nice too.
Google also has some nice tools to help with uploading your site on to their system. Using npm, you can install the firebase tools, login to your Google account and you are ready to go. You can configure your service from your command line.
Other services include both a realtime database and a nosql database. Providing user authentication and running node scripts on their platform is also supported.
So, I'm using the Amazon API gateway to expose the WordPress REST API to my static sites. The API gateway provides throttling and can also provide caching if necessary. I don't have to worry about my backend server getting overwhelmed by API calls. I can also provide authentication and filtering using the Amazon API gateway.
The front-end for my personal site use Reactjs as the javaScript framework. Now my static site is sitting on a content delivery network and I also get the benefit of having my blog on the same site without the need to have a PHP server running it.
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
title: Learning ReactJS by building a headless WordPress powered Site
updated: 2020-09-10 21:43:38Z
created: 2020-09-10 21:43:38Z
---

# Learning ReactJS by building a headless WordPress powered Site.
* Motivation
* Need to redo personal site.
* Want to experiment with front-end development especially JavaScript
* Low-cost hosting with the ability to scale a site if necessary.
* Benefits
* Scalability of a static site
* Benefit of using WordPress to manage my content.
* Completely custom front-end
* Issues
* Everything is custom

## Getting Started
* Setting up WordPress - (WordPress with Composer)[http://composer.rarst.net]
* Using composer, nginx and php71-fpm
* Already know how to configure Apache. Was a good time to get more familiar with php71-fpm and nguni.
* Setting up on my local machine. Already have php configured.
* No desire to mess around with docker containers for this.
* Do use docker containers for my celery and elasticsearch in development
* Composer allows for easy configuration of local WordPress development and for upgrading the production version
* Put everything still in development under dev dependencies
* In production, only composer update the non-dev dependencies
* Tools
* Using johnbloch composer install
* wpackagist for access to packages
* direct access to packages via github
* Getting access to the APIs
* Benefits
* WordPress multisite support
* REST API including multi-site support
* Composer support
* Benefits of AWS
* Use API service for cache and security
* Use cloud services in site
* Low cost hosting
* Automatic CDN for front-end site
* ReCaptcha plugin support
## CSS for site
* Creating timeline via CSS
Loading