- install wsl and ubuntu
- install docker
docker compose upordocker compose up -dfor detached modehttp://localhost:8000/wp-admin/
Attach to wordpress container:
docker ps...get container IDdocker exec -it <container-id> /bin/bash
Show db in client (e.g. datagrip):
- host:
localhost - port :
3309
Create db mysqldump:
docker ps
docker exec <container_id> sh -c 'exec mysqldump -u"username" -p"password" database_name' > database_backup.sql
docker exec my-mysql-container sh -c 'exec mysqldump -uroot -psomewordpress wordpress' > database_backup.sql- Files system link
Example:
- in PLugin Folder, generate PHP file (see Hello world example)
- under Plugins in http://localhost:8000/wp-admin/ activate and see output in footer
ssh user@your-production-server.com...SSH into Your Production Servercd /var/www/html...Navigate to Your Web Root Directorygit clone https://github.com/your-username/my-wp-site.git ....clone repo
e.g. github workflow. SSH private key as a secret in GitHub repository.
name: Deploy to Production
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up SSH
uses: webfactory/ssh-agent@v0.5.3
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Deploy to Server
run: |
ssh user@your-production-server.com 'cd /var/www/html && git pull origin main && composer install && npm install && npm run build'- Run Database Migrations (if applicable): If you're using a tool like WP Migrate DB or a custom migration script, run it to update your production database.
- Clear Cache: Clear any caching plugins or CDN caches to ensure the latest changes are reflected.
- Verify Deployment: Visit your production site and verify that everything is working as expected.
- ``
- ``
- ``
- ``
- ``
- ``