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
- USB-C® cable (either USB-C® to USB-A or USB-C® to USB-C®)
31
+
- The [docker-compose.yml](assets/docker-compose.rar) file used in this tutorial
31
32
32
33
## Instructions
33
34
34
-
First, make sure your Portenta X8 is set up correctly by following the [User Manual's Out-of-the-box experience](https://docs.arduino.cc/tutorials/portenta-x8/user-manual#out-of-the-box-experience).
35
+
First, make sure your Portenta X8 is set up correctly by following the [User Manual's Out-of-the-Box Experience](https://docs.arduino.cc/tutorials/portenta-x8/user-manual#out-of-the-box-experience).
35
36
36
-
### Creating the Docker-compose.yml File
37
+
### Creating the **docker-compose.yml** File
37
38
38
-
The WordPress container we use is a multi-container application, which also requires a database server container. The WordPress multi-container application uses Apache as its web server. This is required to make the service work and it is already included in the container, so it is nothing for us to worry about. We will be using **MariaDB** as our database server container. This container can run on the Portenta X8's architecture. All we need to start using these containers is to write a **docker-compose.yml** file. This file will contain information about what image we want to install and some important configuration information, such as the username for the database, password, timezone and database name. The same goes for the WordPress container: it will contain the password and username and we will also enter the database hostname and which container will be used as the database. We recommend that you change the default passwords to more secure ones by replacing the default ones that are stated in the file below.
39
+
The WordPress container we use is a multi-container application, which also requires a database server container. The WordPress multi-container application uses Apache as its web server. It is required to make the service operational and comes included within the container. We will be using MariaDB as our database server as a container instance.
39
40
41
+
This container can run on the Portenta X8's architecture. To start using these containers is to build a docker-compose.yml file. This file contains information regarding what image we want to install and important configuration details, such as the username for the database, password, timezone, and database name. The same goes for the WordPress container: it will include the password and username. We will also enter the database hostname and which container will be used as the database. We recommend changing the default passwords to more secure ones by replacing the default password defined in the file below.
40
42
41
-
### The Complete Docker-compose.yml File
43
+
### The Complete **docker-compose.yml** File
42
44
43
45
In this section, you can find the complete **docker-compose.yml** file that we will be using for this tutorial.
44
46
@@ -64,39 +66,65 @@ services:
64
66
Wordpress:
65
67
depends_on:
66
68
- db
67
-
image: Wordpress:latest
69
+
image: wordpress:latest
68
70
volumes:
69
71
- Wordpress_data:/var/www/html
70
72
ports:
71
73
- "8000:80"
72
74
restart: always
73
75
environment:
74
-
Wordpress_DB_HOST: db
75
-
Wordpress_DB_USER: Wordpress
76
-
Wordpress_DB_PASSWORD: Wordpress
77
-
Wordpress_DB_NAME: Wordpress
76
+
WORDPRESS_DB_HOST: db
77
+
WORDPRESS_DB_USER: Wordpress
78
+
WORDPRESS_DB_PASSWORD: Wordpress
79
+
WORDPRESS_DB_NAME: Wordpress
78
80
volumes:
79
81
Wordpress_data: {}
80
82
db_data: {}
81
83
```
82
84
83
-
Now let's create a directory on our X8 and put this **docker-compose.yml** file on our device.
85
+
Now let's create a directory on our X8 and put this **docker-compose.yml** file on our device. You can download the file by clicking [here](assets/docker-compose.rar).
84
86
85
87
### Installing The Containers
86
88
87
-
First, we create a directory where we want to add our **docker-compose.yml** file. Using the `mkdir` command we will create a directory named "wordpress-test". Navigate into this directory with a simple `cd` command. Either copy the docker-compose.yml file into this directory or create it directly here. To create the file, we can use `cat > docker-compose.yml`, this will create the file, so you can copy the content of the file from above and paste it. Push enter once to go to a new line and press `ctrl C` to exit the file editor. To copy the file from your computer onto the device use: `adb push <path to docker-compose.yml file> /home/fio/wordpress-test`.
89
+
First, we create a directory where we want to add our **docker-compose.yml** file. Using the `mkdir` command we will create a directory named "wordpress-test". Navigate into this directory with a simple `cd` command. Either copy the docker-compose.yml file into this directory or create it directly here.
90
+
91
+
To create the file, we can use `cat > docker-compose.yml`, this will create the file, so you can copy the content of the file from above and paste it. Push enter once to go to a new line and press `ctrl C` to exit the file editor. To copy the file from your computer onto the device use:
92
+
93
+
```
94
+
adb push <path to docker-compose.yml file> /home/fio/wordpress-test
95
+
```
96
+
97
+
Alternatively, you could place the `docker-compose.yml` file inside the `wordpress-test` directory and push the file using the following command:
98
+
99
+
```
100
+
adb push .\wordpress-test\ /home/fio
101
+
```
102
+
103
+
Both options work fine and depend on how you would like to handle the file.
88
104
89
105

90
106
91
-
Before installing the containers, make sure that no other container is running on the ports that the WordPress container will use. You can check what containers are running and what port they are using by running the `docker ps -a` command. This will show a list of the currently installed and running containers on the Portenta X8. To remove a container first stop it with `docker stop <container id>`, then you can run `docker rm <container id>` to remove it. If you want more information about handling containers on your Portenta X8, take a look at our [managing containers with docker tutorial](https://docs.arduino.cc/tutorials/portenta-x8/docker-container).
107
+
***Remember that you may need to run the next command to gain admin access for running the Docker's commands: `sudo su -` which default password is `fio`***
108
+
109
+
Before installing the containers, make sure that no other container is running on the ports that the WordPress container will use. You can check what containers are running and what port they are using by running the `docker ps -a` command. This will show a list of the currently installed and running containers on the Portenta X8.
110
+
111
+
To remove a container first stop it with `docker stop <container id>`, then you can run `docker rm <container id>` to remove it. If you want more information about handling containers on your Portenta X8, take a look at our [Managing Containers with Docker tutorial](https://docs.arduino.cc/tutorials/portenta-x8/docker-container).
112
+
113
+
When you are in the correct directory and no other container is running on the ports that WordPress will use, you can now run `docker compose up -d`. Using the `-d` tag in the command will allow running these containers in the background. If you run the command without the `-d` tag, the application will exit when you close the terminal.
92
114
93
-
When you are in the correct directory and no other container is running on the ports that WordPress will use, you can now run `docker compose up -d`. Using the `-d` tag in the command will allow running these containers in the background. If you run the command without the `-d` tag, the application will exit when you close the terminal. When the command is executed it will start installing the **WordPress** and **MariaDB** containers. This can take a while. To get the output from the containers use: `docker-compose logs -f`. Once it is done you can connect to the device and site.
115
+
When the command is executed it will start installing the **WordPress** and **MariaDB** containers. This can take a while. To get the output from the containers use: `docker-compose logs -f`. Once it is done you can connect to the device and site.
94
116
95
117

96
118
97
119
### Connecting to the WordPress Site
98
120
99
-
To connect to the WordPress setup site, you simply need to access it with your Portenta X8s unique id and port. So for example: `http://portenta-x8-<uuid>.local:<port>`, where you would substitute the `<uuid>` with your Portenta X8's unique id and the port chosen for the WordPress container with `<port>`. The `<uuid>` can be found on the setup page that is shown in the [User Manual's Out-of-the-box experience](https://docs.arduino.cc/tutorials/portenta-x8/user-manual#out-of-the-box-experience), but you can also see it in the terminal when running `adb` or you can go to `http://192.168.7.1:8000` if you use Windows and Linux, on MacOS use `http://192.168.8.1:8000`.
121
+
To connect to the WordPress setup site, you simply need to access it with your Portenta X8's unique id and port. So we can use the following address format:
122
+
123
+
```
124
+
http://portenta-x8-<uuid>.local:<port>
125
+
```
126
+
127
+
Where you would substitute the `<uuid>` with your Portenta X8's unique id and the port chosen for the WordPress container with `<port>`. The `<uuid>` can be found on the setup page that is shown in the [User Manual's Out-of-the-Box Experience](https://docs.arduino.cc/tutorials/portenta-x8/user-manual#out-of-the-box-experience), but you can also get it in the terminal when running `adb` or you can go to `http://192.168.7.1:8000` if you use Windows and Linux, on MacOS use `http://192.168.8.1:8000`.
100
128
101
129
When you connect, you should get some feedback in the terminal. Text will begin printing in the terminal, showing you information about the connection that has just been established as shown in the image below.
102
130
@@ -108,13 +136,32 @@ Now you should see a webpage, like the following image, in your browser.
108
136
109
137
You are now free to go through the WordPress setup process and configure it however you like.
110
138
139
+
### Removing the containers ###
140
+
141
+
If you want to remove the container, you have to go to ```/home/fio/wordpress-test``` directory (where we previously executed the docker-compose command) and execute the following commands according to your needs:
142
+
143
+
Remove the container but preserves your WordPress database:
144
+
145
+
```
146
+
docker compose down
147
+
```
148
+
149
+
Remove the container and the database:
150
+
151
+
```
152
+
docker compose down --volumes
153
+
```
154
+
155
+
To make sure that it was successful, run ```docker ps -a``` and check that the WordPress and MariaDB containers have disappeared.
156
+
111
157
## Conclusion
112
158
113
159
In this tutorial, we went through how to install and run a WordPress and database container on the Portenta X8. We then accessed the WordPress site on our X8 through our web browser. So now you can set up your own WordPress site on your X8 device and access it from another device.
114
160
115
-
116
161
## Troubleshooting
117
162
118
-
- If the containers are not installing or running correctly, check if there are any other containers currently running on the same ports as the ones used by the WordPress container. You can check this with ``docker ps -a``.
119
-
- If there is any issue running docker commands, make sure you are using ``sudo`` before the commands.
120
-
- If you cannot connect to the site when everything is running, you can double-check the X8s IP address. Run the command `ip s a` in the **adb shell**. This will display the X8's IP address via USB and WiFi. Try connecting via those IP addresses if all the rest fails.
163
+
- If the containers are not being installed or running correctly, check if there are any other containers currently running on the same ports as the ones used by the WordPress container. You can check it with ``docker ps -a``.
164
+
165
+
- If there is any issue running docker commands, make sure you are using ``sudo`` before the commands or having root access using: ``sudo su -r`` with password: ``fio``.
166
+
167
+
- If you cannot connect to the site when everything is running, you can double-check the X8's IP address. Run the command `ip -h address` in the **adb shell**. This will display the X8's IP address via USB and Wi-Fi®. Try connecting via those IP addresses if all the rest fails.
0 commit comments