Black Friday Sale: 50% off all plans!
Use code BLACKFRIDAY50

Header

Comprehensive DeployHQ Guide for ProcessWire

Intro

ProcessWire is a flexible and powerful content management system (CMS) and framework built on the PHP programming language. It's designed to provide developers with a high level of control and customization over their websites, while also offering an easy-to-use interface for content editors.

Here are some key features of ProcessWire:

  • API-driven: ProcessWire is built around a powerful API that allows you to interact with and manipulate your website's content and structure programmatically.

  • Customizable: You can create custom fields, templates, and modules to tailor ProcessWire to your specific needs.

  • Scalable: ProcessWire is designed to handle large-scale websites and can be easily scaled to meet your growing requirements.

  • Secure: ProcessWire includes built-in security features to protect your website from vulnerabilities.

  • Open-source: ProcessWire is a free and open-source project, meaning you can use, modify, and distribute it freely.

ProcessWire is a great choice for developers who want a CMS that gives them full control over their website's functionality and design. It's also a good option for content editors who need a user-friendly interface for managing their website's content.

1. Set Up ProcessWire Project

First, create a new ProcessWire project using Composer:

composer create-project processwire/processwire your-project-name
cd your-project-name

Initialize a Git repository:

git init
git add .
git commit -m "Initial ProcessWire setup"

Create a .gitignore file:

/site/assets/cache/*
/site/assets/logs/*
/site/assets/sessions/*
/site/config.php
/site/modules/*
!/site/modules/.gitkeep
/vendor/
.env

2. Set Up DeployHQ

  1. Create a DeployHQ account at https://www.deployhq.com/
  2. Create a new project in DeployHQ
  3. Connect your Git repository (GitHub, GitLab, Bitbucket, or custom)

3. Configure Deployment in DeployHQ

  1. Go to "Servers & Groups"

  2. Add a new server:

-   Choose protocol (SFTP recommended)
-   Enter server details (hostname, username, password/key)
-   Set deployment path
  1. Create a new deployment:
-   Select branch to deploy
-   Choose the server
-   Set up automatic deployments if desired

4. Environment Configuration

Create a site/config-default.php file:

<?php
$config->dbHost = '{{DB_HOST}}';
$config->dbName = '{{DB_NAME}}';
$config->dbUser = '{{DB_USER}}';
$config->dbPass = '{{DB_PASS}}';

$config->httpHosts = ['{{SITE_URL}}'];
$config->sessionName = '{{SESSION_NAME}}';

// Additional configuration as needed

In DeployHQ, go to "Config Files & Environment" and add these variables.

5. Build Pipeline Configuration

Create .deploybuild.yaml:

build_languages:
  - name: "node"
    version: "18"
  - name: "php"
    version: "8.0"

build_commands:
  - description: "Test Command"
    command: "composer install --no-dev --optimize-autoloader \n npm ci \n npm run build"
    halt_on_error: true

build_cache_files:
  - path: node_modules/**

More info on build commands here.

6. Deployment Hooks

Directly on DeployHQ you can configure Post Deploy SSH Commands, such as:

#!/bin/bash
php site/assets/cache/ClearCache.php
chmod 755 site/assets/cache -R
chmod 755 site/assets/files -R
chmod 755 site/assets/logs -R
chmod 755 site/assets/sessions -R

7. Server Environment Setup

Ensure your server meets ProcessWire requirements:

  • PHP 7.3+ (8.0+ recommended)
  • MySQL 5.7+ or MariaDB 10.2+
  • Apache with mod_rewrite or Nginx

For Nginx, use this configuration:

server {
    listen 80;
    server_name yourdomain.com;
    root /path/to/processwire;

    index index.php;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location ~ \.php$ {
        fastcgi_pass unix:/var/run/php/php8.0-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
    }

    location ~ /\.ht {
        deny all;
    }
}

8. Database Setup

  1. Create a MySQL database for your ProcessWire installation
  2. Note the database name, username, and password for environment variables

9. Deployment

  1. Push your changes to the connected Git repository
  2. In DeployHQ, go to "Deployments" and click "Deploy Now"
  3. Monitor the deployment process

10. ProcessWire Installation

After deployment:

  1. Access your site URL
  2. Follow the ProcessWire installation wizard
  3. Enter database information (using environment variables)
  4. Create an admin account
  5. Choose site profiles if desired

11. Post-Installation

  1. Set up SSL/TLS for your domain
  2. Configure cron jobs for ProcessWire's LazyCron:
* * * * * cd /path/to/site && php -f ./site/modules/LazyCron/LazyCron.php >/dev/null 2>&1
  1. Regularly update ProcessWire and modules

12. Continuous Deployment

  1. Set up automatic deployments in DeployHQ
  2. Configure notifications for successful/failed deployments
  3. Use DeployHQ's rollback feature if needed

13. Performance Optimization

  1. Enable OpCache on your server
  2. Use a CDN for static assets
  3. Implement server-side caching (e.g., Redis)

This expanded guide provides a more comprehensive approach to deploying ProcessWire with DeployHQ, covering additional aspects like server configuration, post-installation steps, and performance optimization.

Tree

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