You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -114,86 +114,11 @@ The server created has the below attributes:
114
114
- Using public-access argument allow you to create a server with public access protected by firewall rules. By providing your IP address to add the firewall rule to allow access from your client machine.
115
115
- Since the command is using Local context it will create the server in the resource group ```wordpress-project``` and in the region ```eastus```.
116
116
117
-
### Build your WordPress docker image
118
-
119
-
Download the [latest WordPress](https://wordpress.org/download/) version. Create new directory ```my-wordpress-app``` for your project and use this simple folder structure
120
-
121
-
```wordpress
122
-
└───my-wordpress-app
123
-
└───public
124
-
├───wp-admin
125
-
│ ├───css
126
-
. . . . . . .
127
-
├───wp-content
128
-
│ ├───plugins
129
-
. . . . . . .
130
-
└───wp-includes
131
-
. . . . . . .
132
-
├───wp-config-sample.php
133
-
├───index.php
134
-
. . . . . . .
135
-
└─── Dockerfile
117
+
## Container definitions
136
118
137
-
```
138
-
139
-
Rename ```wp-config-sample.php``` to ```wp-config.php``` and replace lines from beginingin of ```// ** MySQL settings - You can get this info from your web host ** //``` until the line ```define( 'DB_COLLATE', '' );``` with the code snippet below. The code below is reading the database host, username and password from the Kubernetes manifest file.
140
-
141
-
```php
142
-
//Using environment variables for DB connection information
143
-
144
-
// ** MySQL settings - You can get this info from your web host ** //
In the following example, we're creating two containers, a Nginx web server and a PHP FastCGI processor, based on official Docker images `nginx` and `wordpress` ( `fpm` version with FastCGI support), published on Docker Hub.
163
120
164
-
/** Database Charset to use in creating database tables. */
165
-
define('DB_CHARSET', 'utf8');
166
-
167
-
/** The Database Collate type. Don't change this if in doubt. */
168
-
define('DB_COLLATE', '');
169
-
170
-
171
-
/** SSL*/
172
-
define('MYSQL_CLIENT_FLAGS', MYSQLI_CLIENT_SSL);
173
-
```
174
-
175
-
### Create a Dockerfile
176
-
177
-
Create a new Dockerfile and copy this code snippet. This Dockerfile in setting up Apache web server with PHP and enabling mysqli extension.
178
-
179
-
```docker
180
-
FROM php:7.2-apache
181
-
COPY public/ /var/www/html/
182
-
RUN docker-php-ext-install mysqli
183
-
RUN docker-php-ext-enable mysqli
184
-
```
185
-
186
-
### Build your docker image
187
-
188
-
Make sure you're in the directory ```my-wordpress-app``` in a terminal using the ```cd``` command. Run the following command to build the image:
189
-
190
-
```bash
191
-
192
-
docker build --tag myblog:latest .
193
-
194
-
```
195
-
196
-
Deploy your image to [Docker hub](https://docs.docker.com/get-started/part3/#create-a-docker-hub-repository-and-push-your-image) or [Azure Container registry](../../container-registry/container-registry-get-started-azure-cli.md).
121
+
Alternatively you can build custom docker image(s) and deploy image(s) into [Docker hub](https://docs.docker.com/get-started/part3/#create-a-docker-hub-repository-and-push-your-image) or [Azure Container registry](../../container-registry/container-registry-get-started-azure-cli.md).
197
122
198
123
> [!IMPORTANT]
199
124
> If you are using Azure container regdistry (ACR), then run the ```az aks update``` command to attach ACR account with the AKS cluster.
@@ -202,44 +127,71 @@ Deploy your image to [Docker hub](https://docs.docker.com/get-started/part3/#cre
202
127
> az aks update -n myAKSCluster -g wordpress-project --attach-acr <your-acr-name>
203
128
> ```
204
129
130
+
205
131
## Create Kubernetes manifest file
206
132
207
133
A Kubernetes manifest file defines a desired state for the cluster, such as what container images to run. Let's create a manifest file named `mywordpress.yaml` and copy in the following YAML definition.
208
134
209
135
> [!IMPORTANT]
210
136
>
211
-
> - Replace ```[DOCKER-HUB-USER/ACR ACCOUNT]/[YOUR-IMAGE-NAME]:[TAG]``` with your actual WordPress docker image name and tag, for example ```docker-hub-user/myblog:latest```.
212
137
> - Update ```env``` section below with your ```SERVERNAME```, ```YOUR-DATABASE-USERNAME```, ```YOUR-DATABASE-PASSWORD``` of your MySQL flexible server.
0 commit comments