-
-
Save noogen/aee9e74744b6d71750618339fb677a5d to your computer and use it in GitHub Desktop.
Wordpress using Bitnami docker containers - restore from existing wordpress site
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# USAGE INSTRUCTIONS | |
# 1. Download this .env file, docker-compose.yml file, and put it in a separate folder. | |
# | |
# 2. In above folder with: 'mkdir -p wpsite/mariadb wpsite/wordpress wpsite/dbinit' and 'chown 1001:1001 wpsite/mariadb' | |
# | |
# 3. Upload existing-site-dump.sql file to wpsite/dbinit and your existing wordpress (.htaccess, wp-config.php, and | |
# wp-contents folder) to wpsite/wordpress | |
# | |
# 4. Update the passwords in .env file. Backup 'cp wpsite/wordpress/wp-config.php wpsite/wordpress/wp-config-bak.php' | |
# a. because setting WORDPRESS_SKIP_BOOTSTRAP=yes prevent fresh installation of wordpress, we must edit wp-config.php; | |
# therefore, update wp-config.php with new database configuration - see docker-compose wordpress environments | |
# | |
# b. As this is using bitnami, you may have to add to wp-config.php the setting "define( 'FS_METHOD', 'direct' );" in order | |
# for Wordpress to perform core update from the UI. | |
# | |
# c. Also fix permission with 'chown -R 1001:1001 wpsite/wordpress' before going to step 6. | |
# Optionally, also perform below commands to fix Wordpress file permissions: | |
# find wpsite/wordpress -type d -exec chmod 775 {} \; | |
# find wpsite/wordpress -type f -exec chmod 664 {} \; | |
# chmod 640 wpsite/wordpress/wp-config.php | |
# | |
# 5. Run the containers with -> docker-compose up -d | |
# | |
# 6. Done! | |
# | |
# 7. Now, put it behind CDN like cloudflare for performance. | |
# | |
DB_ROOT_PASS=<replace-with-complex-password1> | |
DB_PASS=<replace-with-complex-password2> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3' | |
services: | |
sitedb: | |
image: docker.io/bitnami/mariadb:11.3 | |
restart: always | |
healthcheck: | |
test: ['CMD', '/opt/bitnami/scripts/mariadb/healthcheck.sh'] | |
interval: 15s | |
timeout: 5s | |
retries: 6 | |
volumes: | |
- ./wpsite/mariadb:/bitnami/mariadb | |
- ./wpsite/dbinit:/docker-entrypoint-startdb.d | |
environment: | |
- MARIADB_ROOT_PASSWORD=${DB_ROOT_PASS} | |
- MARIADB_DATABASE=bitnami_wordpress | |
- MARIADB_USER=bn_wordpress | |
- MARIADB_PASSWORD=${DB_PASS} | |
networks: | |
- wpsite1 | |
wordpress: | |
image: docker.io/bitnami/wordpress:latest | |
restart: always | |
healthcheck: | |
test: ["CMD-SHELL", "/opt/bitnami/wp-cli/bin/wp --path=/bitnami/wordpress cron event run --due-now | grep -c Success > /dev/null"] | |
interval: 5m | |
timeout: 3m | |
retries: 1 | |
ports: | |
- '80:8080' | |
- '443:8443' | |
volumes: | |
- ./wpsite/wordpress:/bitnami/wordpress | |
- ./wpsite/wordpress/.htaccess:/opt/bitnami/wordpress/.htaccess | |
depends_on: | |
- sitedb | |
environment: | |
- WORDPRESS_SKIP_BOOTSTRAP=yes | |
- WORDPRESS_DATABASE_HOST=sitedb | |
- WORDPRESS_DATABASE_PORT_NUMBER=3306 | |
- WORDPRESS_DATABASE_NAME=bitnami_wordpress | |
- WORDPRESS_DATABASE_USER=bn_wordpress | |
- WORDPRESS_DATABASE_PASSWORD=${DB_PASS} | |
networks: | |
- wpsite1 | |
# Optional, in the case you need PhpMyAdmin | |
#phpmyadmin: | |
# depends_on: | |
# - sitedb | |
# image: phpmyadmin/phpmyadmin | |
# restart: always | |
# ports: | |
# - '8888:80' | |
# environment: | |
# PMA_HOST: sitedb | |
# MYSQL_ROOT_PASSWORD: ${DB_ROOT_PASS} | |
# networks: | |
# - wpsite1 | |
networks: | |
wpsite1: | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment