Category: Marketing

  • Building In Public – Designing an automated WordPress deployment engine with Terraform

    If you didn’t know I built a lot of technical experience by building out WordPress websites. I started a business around it. I did quite well. Lately, I’ve been trying to get back into building websites for small businesses. I find that the space of AI has made some of the bigger players too complex even though they claim to be easy.

    My goal is to create a single web page where a user can describe their website and have it auto provision a full WordPress instance build upon core AWS services. The end result will be a fully managed WordPress instance, backed by AWS’s 99.999% up time. It will be fully automated and take around 10 minutes to have a fully developed website.

    Current Architecture Plans:

    I’m utilizing AWS to handle everything (no surprise). Originally I was going to utilize Step Functions as the provisioner but as I started building I ended up hitting too many roadblocks and restrictions from a timing perspective.

    When dealing with Bedrock the response times can vary. So I made the switch to go with an ECS approach. The control plan/signup page is built there so the provisioner should also just be another task.

    Features:

    • Custom Domains
    • Automated SSL
    • Load balancers
    • Auto healing (through auto scaling)
    • Monitoring

    Essentially all the standard features you would expect from a web host. Just without the design portion.

    This will be a new ongoing series for you all to read about. If you’re interested in following along subscribe to my mailing list!

    Don’t miss an update

  • Building a Python Script to Export WordPress Posts: A Step-by-Step Database to CSV Guide

    Today, I want to share a Python script I’ve been using to extract blog posts from WordPress databases. Whether you’re planning to migrate your content, create backups, or analyze your blog posts, this tool makes it straightforward to pull your content into a CSV file.

    I originally created this script when I needed to analyze my blog’s content patterns, but it’s proven useful for various other purposes. Let’s dive into how you can use it yourself.

    Prerequisites

    Before we start, you’ll need a few things set up on your system:

    • Python 3.x installed on your machine
    • Access to your WordPress database credentials
    • Basic familiarity with running Python scripts

    Setting Up Your Environment

    First, you’ll need to install the required Python packages. Open your terminal and run:

    pip install mysql-connector-python pandas python-dotenv

    Next, create a file named .env in your project directory. This will store your database credentials securely:

    DB_HOST=your_database_host
    DB_USERNAME=your_database_username
    DB_PASS=your_database_password
    DB_NAME=your_database_name
    DB_PREFIX=wp  # Usually 'wp' unless you changed it during installation

    The Script in Action

    The script is pretty straightforward – it connects to your WordPress database, fetches all published posts, and saves them to a CSV file. Here’s what happens under the hood:

    • Loads environment variables from your .env file
    • Establishes a secure connection to your WordPress database
    • Executes a SQL query to fetch all published posts
    • Converts the results to a pandas DataFrame
    • Saves everything to a CSV file named ‘wordpress_blog_posts.csv’

    Running the script is as simple as:

    python main.py

    Security Considerations

    A quick but important note about security: never commit your .env file to version control. I’ve made this mistake before, and trust me, you don’t want your database credentials floating around in your Git history. Add .env to your .gitignore file right away.

    Potential Use Cases

    I wrote this script to feed my posts to AI to help with SEO optimization and also help with writing content for my other businesses. Here are some other ways I’ve found this script useful:

    • Creating offline backups of blog content
    • Analyzing post patterns and content strategy
    • Preparing content for migration to other platforms
    • Generating content reports

    Room for Improvement

    The script is intentionally simple, but there’s plenty of room for enhancement. You might want to add:

    • Support for extracting post meta data
    • Category and tag information
    • Featured image URLs
    • Comment data

    Wrapping Up

    This tool has saved me countless hours of manual work, and I hope it can do the same for you. Feel free to grab the code from my GitHub repository and adapt it to your needs. If you run into any issues or have ideas for improvements, drop a comment below.

    Happy coding!

    Get the code on GitHub