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
- Create a Git repository for your TextPattern project
- Add your TextPattern files to the repository, excluding:
.git/
textpattern/config.php
files/*
images/*
Create a .gitignore
file with these exclusions.
2. Configure DeployHQ
- Sign up for DeployHQ and create a new project
- Connect your Git repository (GitHub, BitBucket, etc.)
- 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
- Make changes to your local repository
- Commit and push to your Git repository
- DeployHQ will automatically:
- Deploy code changes
- Preserve shared files
- Run the deployment script
- Set correct permissions
6. Best Practices
- Use environment-specific configurations
- Keep sensitive data in DeployHQ variables
- Maintain separate branches for staging/production
- Use deployment hooks for database migrations
- Set up automatic deployments on push
7. Rollback Strategy
Configure DeployHQ rollback settings:
- Enable rollback feature
- Set number of releases to keep
- 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.