Install WordPress Pete on Google Cloud (Production)

1 — Provision the server

Log in to the Google Cloud.

Path: Compute Engine → VM instances → Create instance

  • Name: pete-prod

  • Region/Zone: nearest to your users

  • Machine type: e2-standard-2 (2 vCPU, 8 GB) to start

  • Boot disk: Ubuntu 24.04 LTS
    (Change → OS: Ubuntu → Version: 24.04 LTS → Select)

  • Firewall: check Allow HTTP and Allow HTTPS

Click Create.


2) Reserve & Attach a Static External IP

(Prevents DNS changes when the VM reboots)

Reserve:
VPC network → IP addresses → Reserve external static IP address

  • Type: Regional, Version: IPv4

  • Name: pete-prod-ip

  • Region: same as your VM

Assign:
Compute Engine → VM instances → pete-prod → Edit → Network interfaces

  • External IP: select pete-prod-ip
    Click Save.


3) Open Required Ports (if you didn’t tick HTTP/HTTPS)

Path: VPC network → Firewall rules → Create firewall rule

  • Name: allow-web

  • Direction: Ingress

  • Targets: All instances in the network (or restrict via tags)

  • Source IPv4 ranges: 0.0.0.0/0

  • Protocols/ports: tcp:80,443,22

Create the rule.

Tip: After you finish setup, consider restricting SSH (22/tcp) to your office IPs.


4) (Recommended) Enable OS Login for SSH

Why: IAM-based SSH access (easier user management, revocation, and 2FA).

Project-wide:
Compute Engine → Metadata → Edit → Add item

  • Key: enable-oslogin

  • Value: TRUE
    Save.

Per-VM (alternative):
Compute Engine → VM instances → pete-prod → Edit → Metadata → Add item

  • Key: enable-oslogin

  • Value: TRUE
    Save.

Also assign your user the IAM role Compute OS Login (or Compute OS Admin Login).

Security best practice: Prefer OS Login or IAP tunneling instead of leaving SSH open to the internet.

2 — Connect over SSH

From your local terminal, replace <PUBLIC_SERVER_IP> with the server’s address and connect as root:

3 — Run the Pete installer

ssh root@<PUBLIC_SERVER_IP>

Paste the one-liner below into the SSH session; it downloads, makes executable, and launches the installer:

curl -o pete_installer.sh -L https://deploypete.com/pete_installer.sh && chmod 755 pete_installer.sh && sudo ./pete_installer.sh

4. Launch Pete in your browser

When the script completes, simply visit:

http://<YOUR_SERVER_IP>

5. (Optional — Recommended) Harden SSH & Firewall

Still connected as root, tighten basic security in one sweep

# ── Change SSH to a non-standard port (2222) ──
sed -i 's/^#\?Port .*/Port 2222/' /etc/ssh/sshd_config
systemctl restart ssh
# ── Refresh UFW rules ──
# drop old SSH port
ufw delete limit 22/tcp
# rate-limited new SSH port
ufw limit 2222/tcp
# Allow HTTP
ufw allow 80/tcp
# Allow HTTPS
ufw allow 443/tcp
ufw --force enable

Next time you connect:

ssh -p 2222 root@<YOUR_SERVER_IP>

System Passwords & Environment Variables

All secrets generated during installation—database credentials, API keys, reload tokens, etc.—live in /opt/wordpress-pete/.env

# View the file (read-only)<br />
sudo cat /opt/wordpress-pete/.env

Switching WordPress Pete to a Different PHP Version — Zero Downtime

1. Edit the version flag

Keep it safe

  • This file is the single source of truth for every password and token in your stack—treat it like a vault key.

  • Restrict access: chmod 600 /opt/wordpress-pete/.env (owner-read/write only).

  • Never commit it to version control or share it in support tickets.

sudo vim /opt/wordpress-pete/.env

Find PHP_VERSION= and set it to 8.1, 8.2, or 8.3. Save & exit.

2. Re-build the PHP image

docker compose build --no-cache php

3. Hot-swap the container

Launch the freshly built PHP container (no other services are touched)

docker compose up -d php

4. Verify

Sign back in to WordPress Pete and visit /admin/phpinfo to confirm the new PHP version is active.

Docker Compose Cheat-Sheet

Task Command (inside your project folder) When / Why you use it
WordPress Pete Docker project route cd /opt/wordpress-pete Browse to the project dir
Start or re-build the stack

cd /opt/wordpress-pete

docker compose pull
docker compose build
docker compose up -d
Builds images if they changed and launches every service in the foreground. Hit Ctrl +C to stop.
Open a shell in a container

docker compose exec php bash

docker compose exec apache bash

docker compose exec mysql bash

Inspect logs, run WP-CLI / Artisan, edit files quickly.
Re-build after editing a Dockerfile docker compose build --no-cache apache
docker compose build --no-cache php
docker compose build --no-cache mysql
Forces a clean image rebuild for wordpress, apache, or php after you tweak their Dockerfile.
Delete all volumes (nuke-and-pave) bash docker compose down -v Stops containers and removes every named/anonymous volume—irreversible.
Restart Apache inside its container bash docker compose exec apache bash -c "apache2ctl restart" Applies v-host changes without recreating the whole stack.
Where Apache keeps v-hosts /etc/apache2/sites-available – staging configs /etc/apache2/sites-enabled – live symlinks Edit a file in sites-available, then run apache2ctl graceful (from inside the container).
Where Apache keeps the website files /var/www/html Pete files path:
/var/www/html/Pete
Enter MySQL as root docker compose exec mysql -u root -p (password = MYSQL_ROOT_PASSWORD in .env) Handy for one-off queries or importing .sql dumps.