Add these lines to your hosts
file:
127.0.0.1 laradock.test
127.0.0.1 *.laradock.test
This project can be used with any Linux/Mac environment with Docker installed. WSL2 + Docker Desktop is recommended for Windows users.
Prepare WSL2:
PS wsl --set-default-version 2
PS wsl --install --distribution Ubuntu
# Username: user
# Password: secret
PS wsl --set-default Ubuntu
PS wsl -l -v
PS wsl --update
$ sudo apt update && sudo apt upgrade -y
Enter project folder (for example in WSL2), actual path can be vari depending on your setup
$ cd /mnt/c/www-docker/laradock-wordpress
Copy .env
file into it's place:
$ cp .env.example .env
You can define in ./.env
file, which web server you want to use, apache2
or nginx
. For shared hosting target environment, apache2
is preferred. Another diferrence is, nginx
can only host a single site, while apache2
can host multiple sites.
# apache2 or nginx
WEBSERVER=apache2
You also need to define your websites. This is crucial for mass backup & restore shell scripts to work:
SITES=site1,site2
# Examine config
$ ./bin/compose.sh config
# Pull Laradock repository
$ ./bin/compose.sh preinstall
# Start docker-compose
$ ./bin/compose.sh up
# Bootstrap the environment
$ sudo mkdir -p ~/.laradock/backup
$ sudo chown -R $(id -u):$(id -u) ~/.laradock/backup
$ ./bin/compose.sh bootstrap
# Stop the service
$ ./bin/compose.sh down
# Stop the service and destroy everything
$ ./bin/compose.sh prune
# If you want to remove your database and project files, run this command
$ sudo rm -rf ~/.laradock
# To only cleanup Portainer
$ sudo rm -rf ~/.laradock/data/portainer_data
# Backup webserver files & databases
# TODO: copy .htaccess
$ ./bin/compose.sh backup_all
# Restore webserver files & databases
# First, you need to manually delete the project's folder in ~/.laradock/data/html
# then place your backups in ~/.laradock/backup
$ sudo mkdir -p ~/.laradock/backup
$ sudo chown -R $(id -u):$(id -u) ~/.laradock/backup
$ ./bin/compose.sh restore_all
# Backup single website
$ ./bin/backup_single_site.sh -s [sitename]
# Restore single website
$ ./bin/restore_single_site.sh -s [sitename] -l /mnt/[filepath]/backup_[filename].tar.gz
# WP CLI usage
# https://make.wordpress.org/cli/handbook/guides/running-commands-remotely/
$ docker exec laradock-workspace-1 wp --allow-root --help
$ docker exec laradock-workspace-1 wp --allow-root package install wp-cli/restful
$ docker exec laradock-workspace-1 wp --allow-root --http=mesziair.hu --user=mesziair rest user list
Create a link which pointing to insecure_id_rsa.ppk
key inside Laradock's workspace folder.
Laradock: documentation, repository
Self:
- env_file field in Logstash making impossible to use untouched Laradock project structure
- Multiple --env-file cli arguments not be merged correctly, if it's an environment or key configuration option
Others:
- WordPress asking for FTP credentials to install plugins (FIXED)
- Nginx file permission problems (need to change uid/gid for www-data)
wp-content should be owned by www-data:
WSL2 slow filesystem performance: solution is to copy application files into WSL filesystem.
- [wsl2] filesystem performance is much slower than wsl1 in /mnt
- WSL2 Extremely slow file read fix (mutagen)
- Implement Ansible deployment to the Raspberry Pi
- Set UID:GID to 1000 in nginx image
- Create production build from Laradock
- Implement Varnish Cache with nginx: Article, Proxy Cache Purge, FakerPress
# Example to enter a running container
$ docker-compose exec workspace bash
$ docker exec -it {workspace-container-id} bash