Header

Automated TextPattern CMS Deployment

This guide assumes you have already set up a LAMP stack on your target server. Here's how to configure automated deployments:

1. Initial Repository Setup

  1. Create a Git repository for your TextPattern project
  2. Add your TextPattern files to the repository, excluding:
.git/
textpattern/config.php
files/*
images/*

Create a .gitignore file with these exclusions.

2. Configure DeployHQ

  1. Sign up for DeployHQ and create a new project
  2. Connect your Git repository (GitHub, BitBucket, etc.)
  3. Add your server as a deployment target:
    • Select SFTP/SSH deployment
    • Enter your server credentials
    • Set deployment path to /var/www/html

3. Configure Deployment Settings

Create Configuration Files

1- Create a deployhq/shared directory in your repository 2- Add a template config.php file:

<?php
$txpcfg['db'] = '{{DB_NAME}}';
$txpcfg['user'] = '{{DB_USER}}';
$txpcfg['pass'] = '{{DB_PASS}}';
$txpcfg['host'] = 'localhost';
$txpcfg['table_prefix'] = '';
$txpcfg['txpath'] = '/var/www/html/textpattern';
$txpcfg['dbcharset'] = 'utf8mb4';
?>

Set Up Deployment Config

In DeployHQ:

1- Configure Shared Files:

textpattern/config.php
files/
images/

2- Add Server-Specific Config Variables:

DB_NAME=textpattern_db
DB_USER=textpattern_user
DB_PASS=your_secure_password

3- Create a deployment script:

#!/bin/bash

# Set permissions
chmod -R 755 .
find . -type f -exec chmod 644 {} \;
chown -R apache:apache .

# Clear cache
rm -rf tmp/*

# Restart Apache
systemctl restart httpd

4. First-Time Deployment

1- For a fresh installation:

  • Deploy your code first
  • Follow the TextPattern installation steps
  • Save your config.php in DeployHQ's shared files

2- For existing sites:

  • Back up your database
  • Copy existing config.php, files/, and images/ to DeployHQ shared files
  • Deploy your code

5. Ongoing Deployments

  1. Make changes to your local repository
  2. Commit and push to your Git repository
  3. DeployHQ will automatically:
  • Deploy code changes
  • Preserve shared files
  • Run the deployment script
  • Set correct permissions

6. Best Practices

  1. Use environment-specific configurations
  2. Keep sensitive data in DeployHQ variables
  3. Maintain separate branches for staging/production
  4. Use deployment hooks for database migrations
  5. Set up automatic deployments on push

7. Rollback Strategy

Configure DeployHQ rollback settings:

  1. Enable rollback feature
  2. Set number of releases to keep
  3. Create rollback script if needed

This adaptation maintains the core TextPattern functionality while adding automated deployment capabilities through DeployHQ. The main differences are:

  • Version control integration
  • Automated deployments
  • Environment configuration management
  • Shared file handling
  • Deployment scripts
  • Rollback capabilities

Want to learn more about deployment or Astro? Check out our documentation or contact our support team for assistance.

Tree

Proudly powered by Katapult. Running on 100% renewable energy.