Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/websmithcode/nillkizz-wp-abooks
https://github.com/websmithcode/nillkizz-wp-abooks
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/websmithcode/nillkizz-wp-abooks
- Owner: websmithcode
- Created: 2021-12-04T20:18:35.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2022-12-30T05:31:10.000Z (almost 2 years ago)
- Last Synced: 2023-07-24T23:49:42.731Z (over 1 year ago)
- Language: PHP
- Size: 1.93 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.MD
Awesome Lists containing this project
README
# WPDC - WordPress Docker Compose
Easy WordPress development with Docker and Docker Compose.
With this project you can quickly run the following:
- [WordPress and WP CLI](https://hub.docker.com/_/wordpress/)
- [phpMyAdmin](https://hub.docker.com/_/phpmyadmin//)
- [MySQL](https://hub.docker.com/_/mysql/)Contents:
- [Requirements](#requirements)
- [Configuration](#configuration)
- [Installation](#installation)
- [Usage](#usage)## Requirements
Make sure you have the latest versions of **Docker** and **Docker Compose** installed on your machine.
Clone this repository or copy the files from this repository into a new folder. In the **docker-compose.yml** file you may change the IP address (in case you run multiple containers) or the database from MySQL to MariaDB.
Make sure to [add your user to the `docker` group](https://docs.docker.com/install/linux/linux-postinstall/#manage-docker-as-a-non-root-user) when using Linux.
## Configuration
Copy the example environment into `.env`
```
cp env.example .env
```Edit the `.env` file to change the default IP address, MySQL root password and WordPress database name.
## Installation
Open a terminal and `cd` to the folder in which `docker-compose.yml` is saved and run:
```
docker-compose up
```This creates two new folders next to your `docker-compose.yml` file.
* `wp-data` – used to store and restore database dumps
* `wp-app` – the location of your WordPress applicationThe containers are now built and running. You should be able to access the WordPress installation with the configured IP in the browser address. By default it is `http://127.0.0.1`.
For convenience you may add a new entry into your hosts file.
## Usage
### Starting containers
You can start the containers with the `up` command in daemon mode (by adding `-d` as an argument) or by using the `start` command:
```
docker-compose start
```### Stopping containers
```
docker-compose stop
```### Removing containers
To stop and remove all the containers use the`down` command:
```
docker-compose down
```Use `-v` if you need to remove the database volume which is used to persist the database:
```
docker-compose down -v
```### Project from existing source
Copy the `docker-compose.yml` file into a new directory. In the directory you create two folders:
* `wp-data` – here you add the database dump
* `wp-app` – here you copy your existing WordPress codeYou can now use the `up` command:
```
docker-compose up
```This will create the containers and populate the database with the given dump. You may set your host entry and change it in the database, or you simply overwrite it in `wp-config.php` by adding:
```
define('WP_HOME','http://127.0.0.1:8080');
define('WP_SITEURL','http://127.0.0.1:8080');
```### Creating database dumps
```
./msqldump.sh
```### Developing a Theme
Configure the volume to load the theme in the container in the `docker-compose.yml`:
```
volumes:
- ./theme-name/:/var/www/html/wp-content/themes/theme-name
```### Developing a Plugin
Configure the volume to load the plugin in the container in the `docker-compose.yml`:
```
volumes:
- ./plugin-name/:/var/www/html/wp-content/plugins/plugin-name
```### WP CLI
The docker compose configuration also provides a service for using the [WordPress CLI](https://developer.wordpress.org/cli/commands/).
Sample command to install WordPress:
```
docker-compose run --rm wpcli core install --url=http://localhost --title=test --admin_user=admin [email protected]
```Or to list installed plugins:
```
docker-compose run --rm wpcli plugin list
```For an easier usage you may consider adding an alias for the CLI:
```
alias wp="docker-compose run --rm wpcli"
```This way you can use the CLI command above as follows:
```
wp plugin list
```### phpMyAdmin
You can also visit `http://127.0.0.1:8080` to access phpMyAdmin after starting the containers.
The default username is `root`, and the password is the same as supplied in the `.env` file.