Staging, Test und Preview Webserver
Contact :
- Hervé Bonnaffoux
- Sebastian Druschel
This is a structured approach to deploying your website from local development through to a live preview server, utilizing GitLab for version control, ISP Config for server configuration, and Cyberduck/FileZilla for file management.
Recap of Useful Links and Resources
[edit]Documentation and Tools
[edit]- GitLab: Visit GitLab
- Cyberduck: Download Cyberduck
- FileZilla: Download FileZilla
- WP Migrate Plugin: WP Migrate
- phpMyAdmin Access: Access phpMyAdmin
Server and Database Information
[edit]- Preview Server Domain:
psl.dev - phpMyAdmin for Database Management: Access phpMyAdmin
- Server Address for ISP Config:
pslsrv57.p5l.io - ISP CONFIG : https://10.1.10.57:8080/
1. Project and Environment Setup
[edit]GitLab Repository Configuration
[edit]Create your project in GitLab with a main branch (set to default) for production and a develop branch for ongoing development and preview server.
Local Development with Docker
[edit]Your WordPress website runs in a Docker environment for consistent local development setups.
2. GitLab CI/CD Configuration
[edit]Configure your .gitlab-ci.yml file to define the stages of your CI/CD pipeline, specifying actions for building your site and deploying it to the preview server. Example configuration:<syntaxhighlight>
stages:
- build - deploy
variables:
DEPLOYMENT_DIRECTORY: "deploy-${CI_COMMIT_REF_NAME}"
Build Site:
stage: build script: - echo "Building site..." # Placeholder for build scripts, e.g., composer install
Deploy to Preview Server:
stage: deploy script: - echo "Deploying to server..." # Commands for SSH access and rsync to transfer files to the server only: - develop
</syntaxhighlight>This setup triggers actions when changes are pushed to the develop branch, automating the deployment process to your preview server.
3. ISP Config Server Preparation
[edit]Accessing ISP Config
[edit]- Log In: Access the ISP Config dashboard by navigating to
pslsrv57.p5l.io. Use your credentials to log in to the control panel where you'll manage server settings and resources.
Database User Creation
[edit]- Navigate to Database Users: Within ISP Config, locate the Database section and find the option to manage or add new database users.
- Create New User: Enter the required details for your new database user, such as username and password. Ensure this user has the necessary permissions to create, modify, and delete database tables which WordPress requires.
Database Creation
[edit]- Navigate to Databases: In the same Database section, look for an option to create a new database.
- Create Database: Fill in the database name and select the user you previously created as the owner. This database will be used by WordPress to store all site content, including posts, pages, and user information.
SSH/SFTP User Setup
[edit]- Creating a Shell User: For secure file operations and maintenance tasks, you'll need to create a shell user. This is typically done in the System or User section of ISP Config.
- Assign Permissions: Ensure the shell user has adequate permissions for the web directory where your WordPress site will reside. This allows for file management tasks including uploads, updates, and backups.
SSH Key Configuration
[edit]- Generate SSH Keys: If you haven't already, generate an SSH key pair on your local machine using
ssh-keygen. This command creates a private key, which stays on your machine, and a public key, which you'll upload to the server. - Add SSH Public Key: In ISP Config, find the option to manage SSH keys for your shell user. Upload the public key generated by
ssh-keygen. This setup enables password-less secure access to your server, which is particularly useful for automated deployments via GitLab CI/CD pipelines.
4. File Management with Cyberduck/FileZilla
[edit]Configure a profile in your chosen file management tool using the SSH/SFTP user details for easy file transfers.
5. WordPress Configuration and Deployment
[edit]WordPress File Structure
[edit]Your setup includes the conf, wp-content, and custom {name} directories for WordPress configurations and content.
WordPress Multisite Installation
[edit]Command: Install WordPress multisite using WP-CLI with the following command executed on the server:<syntaxhighlight> wp core multisite-install --title="WordPress Multisite Base Install" --url=localhost --allow-root --skip-email --admin_user="admin" --admin_password="admin" --admin_email="admin@admin.com"
</syntaxhighlight>
- Adjust the
--urlparameter as necessary to match your preview server's domain.
Plugin Activation and Data Migration
[edit]- Activate Plugins: Ensure all required WordPress plugins are activated.
- Data Migration with WP Migrate: Utilize the WP Migrate plugin to transfer the database and content from your local development environment (or where the DB you want to migrate is located) to the preview server.
6. Testing and Debugging
[edit]Ensure comprehensive testing and employ error logging for effective debugging.