Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wordpress Folder availability and MySQL persistency #5

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
24 changes: 11 additions & 13 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
# ignore everything in the root except the "wp-content" directory.
!wp-content/

# ignore everything in the "wp-content" directory, except:
# "mu-plugins", "plugins", "themes" directory
wp-content/*
!wp-content/mu-plugins/
!wp-content/plugins/
!wp-content/themes/
# ignore main wordpress files
wp-root/*
!wp-root/wp-content/

# ignore these plugins
wp-content/plugins/hello.php
# ignore the default plugins
wp-root/wp-content/plugins/hello.php
wp-root/wp-content/plugins/index.php
wp-root/wp-content/plugins/akismet/*

# ignore specific themes
wp-content/themes/twenty*/
# ignore the default themes
wp-root/wp-content/themes/twenty*/
wp-root/wp-content/themes/index.php

# ignore node dependency directories
node_modules/

# ignore log files and databases
*.log
*.sql
*.sqlite
*.sqlite
23 changes: 21 additions & 2 deletions .gitpod.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,27 @@
tasks:
- init: |
- name: Install
# The built step is helpful because we modify the wordpress docker image to include wp-CLI
init: |
docker-compose pull
- command: |
docker-compose build
echo "Docker images built. Starting Docker..."
command: |
gp sync-done docker
docker-compose up

- name: Set permission
# Waits a little and then configures Wordpress
# Last line opens Website in new browser window
# Set permission that "gitpod" user can access folders created inside docker container. Couldn't find a better way.
init: |
gp sync-await docker
echo "Waiting 10s for DB to get ready..."
sleep 10
sudo chmod -R 755 ./wp-root
sudo chown -R gitpod:gitpod ./wp-root
# Then open Wordpress in Browser and tail logs
command: |
gp preview $(gp url 8000) --external

vscode:
extensions:
Expand Down
13 changes: 6 additions & 7 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
version: "3.9"


services:
db:
image: mysql:5.7
image: mysql:latest
volumes:
- database:/var/lib/mysql
restart: always
Expand All @@ -16,17 +15,17 @@ services:
depends_on:
- db
image: wordpress:latest
volumes:
- src:/var/www/html
ports:
- "8000:80"
restart: always
environment:
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_USER: wordpress
WORDPRESS_DB_PASSWORD: wordpress
WORDPRESS_DB_NAME: wordpress
volumes:
- ./wp-root:/var/www/html
- ./apache-logs/:/var/log/apache2

volumes:
database:
src:
apache-logs: