CatPtain commited on
Commit
7701176
Β·
verified Β·
1 Parent(s): ca91bf2

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +159 -11
README.md CHANGED
@@ -1,11 +1,159 @@
1
- ---
2
- title: Wordpress
3
- emoji: πŸƒ
4
- colorFrom: green
5
- colorTo: yellow
6
- sdk: docker
7
- pinned: false
8
- license: mit
9
- ---
10
-
11
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # WPDC - WordPress Docker Compose
2
+
3
+ Easy WordPress development with Docker and Docker Compose.
4
+
5
+ With this project you can quickly run the following:
6
+
7
+ - [WordPress and WP CLI](https://hub.docker.com/_/wordpress/)
8
+ - [phpMyAdmin](https://hub.docker.com/r/phpmyadmin/phpmyadmin/)
9
+ - [MySQL](https://hub.docker.com/_/mysql/)
10
+
11
+ Contents:
12
+
13
+ - [Requirements](#requirements)
14
+ - [Configuration](#configuration)
15
+ - [Installation](#installation)
16
+ - [Usage](#usage)
17
+
18
+ ## Requirements
19
+
20
+ Make sure you have the latest versions of **Docker** and **Docker Compose** installed on your machine.
21
+
22
+ 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.
23
+
24
+ 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.
25
+
26
+ ## Configuration
27
+
28
+ Copy the example environment into `.env`
29
+
30
+ ```
31
+ cp env.example .env
32
+ ```
33
+
34
+ Edit the `.env` file to change the default IP address, MySQL root password and WordPress database name.
35
+
36
+ ## Installation
37
+
38
+ Open a terminal and `cd` to the folder in which `docker-compose.yml` is saved and run:
39
+
40
+ ```
41
+ docker-compose up
42
+ ```
43
+
44
+ This creates two new folders next to your `docker-compose.yml` file.
45
+
46
+ * `wp-data` – used to store and restore database dumps
47
+ * `wp-app` – the location of your WordPress application
48
+
49
+ The 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`.
50
+
51
+ For convenience you may add a new entry into your hosts file.
52
+
53
+ ## Usage
54
+
55
+ ### Starting containers
56
+
57
+ You can start the containers with the `up` command in daemon mode (by adding `-d` as an argument) or by using the `start` command:
58
+
59
+ ```
60
+ docker-compose start
61
+ ```
62
+
63
+ ### Stopping containers
64
+
65
+ ```
66
+ docker-compose stop
67
+ ```
68
+
69
+ ### Removing containers
70
+
71
+ To stop and remove all the containers use the`down` command:
72
+
73
+ ```
74
+ docker-compose down
75
+ ```
76
+
77
+ Use `-v` if you need to remove the database volume which is used to persist the database:
78
+
79
+ ```
80
+ docker-compose down -v
81
+ ```
82
+
83
+ ### Project from existing source
84
+
85
+ Copy the `docker-compose.yml` file into a new directory. In the directory you create two folders:
86
+
87
+ * `wp-data` – here you add the database dump
88
+ * `wp-app` – here you copy your existing WordPress code
89
+
90
+ You can now use the `up` command:
91
+
92
+ ```
93
+ docker-compose up
94
+ ```
95
+
96
+ 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:
97
+
98
+ ```
99
+ define('WP_HOME','http://wp-app.local');
100
+ define('WP_SITEURL','http://wp-app.local');
101
+ ```
102
+
103
+ ### Creating database dumps
104
+
105
+ ```
106
+ ./export.sh
107
+ ```
108
+
109
+ ### Developing a Theme
110
+
111
+ Configure the volume to load the theme in the container in the `docker-compose.yml`:
112
+
113
+ ```
114
+ volumes:
115
+ - ./theme-name/trunk/:/var/www/html/wp-content/themes/theme-name
116
+ ```
117
+
118
+ ### Developing a Plugin
119
+
120
+ Configure the volume to load the plugin in the container in the `docker-compose.yml`:
121
+
122
+ ```
123
+ volumes:
124
+ - ./plugin-name/trunk/:/var/www/html/wp-content/plugins/plugin-name
125
+ ```
126
+
127
+ ### WP CLI
128
+
129
+ The docker compose configuration also provides a service for using the [WordPress CLI](https://developer.wordpress.org/cli/commands/).
130
+
131
+ Sample command to install WordPress:
132
+
133
+ ```
134
+ docker-compose run --rm wpcli core install --url=http://localhost --title=test --admin_user=admin [email protected]
135
+ ```
136
+
137
+ Or to list installed plugins:
138
+
139
+ ```
140
+ docker-compose run --rm wpcli plugin list
141
+ ```
142
+
143
+ For an easier usage you may consider adding an alias for the CLI:
144
+
145
+ ```
146
+ alias wp="docker-compose run --rm wpcli"
147
+ ```
148
+
149
+ This way you can use the CLI command above as follows:
150
+
151
+ ```
152
+ wp plugin list
153
+ ```
154
+
155
+ ### phpMyAdmin
156
+
157
+ You can also visit `http://127.0.0.1:8080` to access phpMyAdmin after starting the containers.
158
+
159
+ The default username is `root`, and the password is the same as supplied in the `.env` file.