Skip to content
Snippets Groups Projects
Commit dc93dcd5 authored by Denis GERMAIN's avatar Denis GERMAIN
Browse files
parent 51bf0e3d
No related branches found
No related tags found
No related merge requests found
......@@ -33,10 +33,16 @@ You need to run 2 containers:
### Using docker run
Start by running a MySQL container and ensure you configure MySQL to use UTF8. The command below will also configure the MySQL container to save its data on your localhost in a `/my/own/mysql` directory:
Start by creating a dedicated docker network
```console
docker run --name mysql-xwiki -v /my/own/mysql:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=xwiki -e MYSQL_USER=xwiki -e MYSQL_PASSWORD=xwiki -e MYSQL_DATABASE=xwiki -d mysql:5.7 --character-set-server=utf8 --collation-server=utf8_bin --explicit-defaults-for-timestamp=1
docker network create -d bridge xwiki-nw
```
Then run a MySQL container and ensure you configure MySQL to use UTF8. The command below will also configure the MySQL container to save its data on your localhost in a `/my/own/mysql` directory:
```console
docker run --net=xwiki-nw --name mysql-xwiki -v /my/own/mysql:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=xwiki -e MYSQL_USER=xwiki -e MYSQL_PASSWORD=xwiki -e MYSQL_DATABASE=xwiki -d mysql:5.7 --character-set-server=utf8 --collation-server=utf8_bin --explicit-defaults-for-timestamp=1
```
You should adapt the command line to use the passwords that you wish for the MySQL root password and for the xwiki user password.
......@@ -44,10 +50,10 @@ You should adapt the command line to use the passwords that you wish for the MyS
Then run XWiki in another container by issuing the following command:
```console
docker run --name xwiki -p 8080:8080 -v /my/own/xwiki:/usr/local/xwiki -e MYSQL_USER=xwiki -e MYSQL_PASSWORD=xwiki -e MYSQL_DATABASE=xwiki --link mysql-xwiki:db xwiki:mysql-tomcat
docker run -d --net=xwiki-nw --name xwiki -p 8080:8080 -v /my/own/xwiki:/usr/local/xwiki -e MYSQL_USER=xwiki -e MYSQL_PASSWORD=xwiki -e MYSQL_DATABASE=xwiki -e MYSQL_CONTAINER_NAME=mysql-xwiki xwiki:mysql-tomcat
```
Be careful to use the same MySQL username, password and database names that you've used on the first command to start the MySQL container.
Be careful to use the same MySQL username, password and database names that you've used on the first command to start the MySQL container. Also, please don't forget to add a '-e MYSQL_CONTAINER_NAME=' env variable with the name of the previously created MySQL container so that tomcat knows where its database is.
### Using docker-compose
......
......@@ -49,6 +49,8 @@ function configure() {
echo 'Configuring XWiki...'
sed -i "s/replacemysqluser/${MYSQL_USER:-xwiki}/g" /usr/local/tomcat/webapps/ROOT/WEB-INF/hibernate.cfg.xml
sed -i "s/replacemysqlpassword/${MYSQL_PASSWORD:-xwiki}/g" /usr/local/tomcat/webapps/ROOT/WEB-INF/hibernate.cfg.xml
sed -i "s/replacemysqlcontainername/${MYSQL_CONTAINER_NAME:-db}/g" /usr/local/tomcat/webapps/ROOT/WEB-INF/hibernate.cfg.xml
sed -i "s/replacemysqldatabase/${MYSQL_DATABASE:-xwiki}/g" /usr/local/tomcat/webapps/ROOT/WEB-INF/hibernate.cfg.xml
echo ' Using filesystem-based attachments...'
xwiki_set_cfg 'xwiki.store.attachment.hint' 'file'
......
......@@ -84,7 +84,7 @@
- if you want the main wiki database to be different than "xwiki"
you will also have to set the property xwiki.db in xwiki.cfg file
-->
<property name="connection.url">jdbc:mysql://db/${MYSQL_DATABASE:-xwiki}?useSSL=false</property>
<property name="connection.url">jdbc:mysql://replacemysqlcontainername/replacemysqldatabase?useSSL=false</property>
<property name="connection.username">replacemysqluser</property>
<property name="connection.password">replacemysqlpassword</property>
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment

Consent

On this website, we use the web analytics service Matomo to analyze and review the use of our website. Through the collected statistics, we can improve our offerings and make them more appealing for you. Here, you can decide whether to allow us to process your data and set corresponding cookies for these purposes, in addition to technically necessary cookies. Further information on data protection—especially regarding "cookies" and "Matomo"—can be found in our privacy policy. You can withdraw your consent at any time.