Skip to content

Commit

Permalink
More code comment. Rename /home/dolibarr_data into
Browse files Browse the repository at this point in the history
/home/dolibarr_documents
  • Loading branch information
eldy committed Sep 8, 2024
1 parent 40f4d2e commit aadadb0
Show file tree
Hide file tree
Showing 17 changed files with 68 additions and 37 deletions.
26 changes: 18 additions & 8 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,49 @@
# Contributing
1. Create only head Dolibarr version for each Major release in file `versions.sh`.

1. List one head Dolibarr version for each Major release in the file `versions.sh`.
2. Keep only one Dockerfile.template file, use `sed` value replacement in `update.sh`
3. Keep most up to date PHP version that matches each [Dolibarr releases](https://wiki.dolibarr.org/index.php/Versions).
4. Be careful about [supported PHP versions](https://www.php.net/supported-versions.php), try to avoid deprecated PHP version, but only if it doesn't break rule #3.
5. Run the `update.sh` script
6. check the `README.md`, to ensure it is well formatted (on some environment `Supported Tags` could be broken)
5. Run the `update.sh` script to generate all the files rquired to build each Docker images.
6. Check the `README.md`, to ensure it is well formatted (on some environment `Supported Tags` could be broken)
7. Commit all content in `images` directory
8. Open a pull request with a polite and well described content ^_^


# How to create images
All is done through the `update.sh` script, Dolibarr version to build are stored in `versions.sh`

All is done through the `update.sh` script, Dolibarr versions to build are stored in `versions.sh`
Ensure that the var `DOLIBARR_VERSIONS` in `versions.sh` is having all versions you want to build.
Run the script.
Just run the script update.sh.

## Tips
You can ask the script to build and push version for you: just add `DOCKER_BUILD=1` and `DOCKER_PUSH=1` in command line.
```bash
$> DOCKER_BUILD=1 DOCKER_PUSH=1 ./update.sh
```


# Test your local copy before PR

For convenience, you can use the `test.sh` script, it will build and run containers based on existing Dockerfile in `images` directory. (You'd better run `update.sh` before)
```bash
$> ./test.sh <DOLIBARR_VERSION> <PHP_VERSION>
$> sudo ./test.sh <DOLIBARR_VERSION> <PHP_VERSION>
```
* DOLIBARR_VERSION : (Mandatory) the version you want to build and run.
* PHP_VERSION : (Optional) the Dolibarr version with this PHP version you want to run specifically, if omitted it will use the most up to date PHP version.

If you want to run Dolibarr 14.0.3 with PHP 7.4
```bash
$> ./test.sh 14.0.3 7.4
$> sudo ./test.sh 14.0.3 7.4
```
If you want to run Dolibarr 14.0.3 with most up-to-date PHP version
```bash
$> ./test.sh 14.0.3
$> sudo ./test.sh 14.0.3
```

If you want to run Dolibarr develop with most up-to-date PHP version
```bash
$> sudo ./test.sh develop
```

Here are links for running containers :
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ using the tools saved in the [Dolibarr docker build repository](https://github.c
This image does not contains database, so you need to link it with a database container. Let's use [Docker Compose](https://docs.docker.com/compose/) to integrate it with [MariaDB](https://hub.docker.com/_/mariadb/) (you can also use [MySQL](https://hub.docker.com/_/mysql/) if you prefer):

If you want to have a persistent database and dolibarr data files after reboot or upgrade, you must first
create a directory /home/mariadb_data, /home/dolibarr_data and /home/dolibarr_custom on you host to store persistent files, respectively, of the database, of the Dolibarr document fils and of the external Dolibarr modules.
create a directory `/home/mariadb_data`, `/home/dolibarr_documents` and `/home/dolibarr_custom` on your host to store persistent files, respectively, of the database, of the Dolibarr document files and of the installed external Dolibarr modules.

`mkdir /home/mariadb_data /home/dolibarr_data /home/dolibarr_custom;`
`mkdir /home/mariadb_data /home/dolibarr_documents /home/dolibarr_custom;`

Then, create a `docker-compose.yml` file as following:

Expand All @@ -61,13 +61,13 @@ services:
DOLI_URL_ROOT: 'http://0.0.0.0'
DOLI_ADMIN_LOGIN: 'admin'
DOLI_ADMIN_PASSWORD: 'admin'
PHP_INI_DATE_TIMEZONE: 'Europe/Paris'
DOLI_INIT_DEMO: 0
ports:
- "80:80"
links:
- mariadb
volumes:
- /home/dolibarr_data:/var/www/documents
- /home/dolibarr_documents:/var/www/documents
- /home/dolibarr_custom:/var/www/html/custom
```
Expand Down
8 changes: 4 additions & 4 deletions README.template
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ using the tools saved in the [Dolibarr docker build repository](https://github.c
This image does not contains database, so you need to link it with a database container. Let's use [Docker Compose](https://docs.docker.com/compose/) to integrate it with [MariaDB](https://hub.docker.com/_/mariadb/) (you can also use [MySQL](https://hub.docker.com/_/mysql/) if you prefer):

If you want to have a persistent database and dolibarr data files after reboot or upgrade, you must first
create a directory /home/mariadb_data, /home/dolibarr_data and /home/dolibarr_custom on you host to store persistent files, respectively, of the database, of the Dolibarr document fils and of the external Dolibarr modules.
create a directory `/home/mariadb_data`, `/home/dolibarr_documents` and `/home/dolibarr_custom` on your host to store persistent files, respectively, of the database, of the Dolibarr document files and of the installed external Dolibarr modules.

`mkdir /home/mariadb_data /home/dolibarr_data /home/dolibarr_custom;`
`mkdir /home/mariadb_data /home/dolibarr_documents /home/dolibarr_custom;`

Then, create a `docker-compose.yml` file as following:

Expand All @@ -55,13 +55,13 @@ services:
DOLI_URL_ROOT: 'http://0.0.0.0'
DOLI_ADMIN_LOGIN: 'admin'
DOLI_ADMIN_PASSWORD: 'admin'
PHP_INI_DATE_TIMEZONE: 'Europe/Paris'
DOLI_INIT_DEMO: 0
ports:
- "80:80"
links:
- mariadb
volumes:
- /home/dolibarr_data:/var/www/documents
- /home/dolibarr_documents:/var/www/documents
- /home/dolibarr_custom:/var/www/html/custom
```

Expand Down
7 changes: 5 additions & 2 deletions docker-init.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/usr/bin/env php
<?php
# This script is called by the docker-run.sh script to enabled modules during Dolibarr first installation.
# It is embedded into the Docker image of dolibarr/dolibarr.

require_once '../htdocs/master.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';

Expand Down Expand Up @@ -32,9 +35,9 @@
$mods = explode(',', getenv('DOLI_ENABLE_MODULES'));
foreach ($mods as $mod) {
printf("Activating module ".$mod." ...");
try {
try {
$res = activateModule('mod' . $mod);
if ($res < 0) {
if ($res < 0) {
print(" FAILED. Unable to load module. Be sure to check the case\n");
} else {
printf(" OK\n");
Expand Down
2 changes: 1 addition & 1 deletion docker-run.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash
# This script is run when the Docker web container is started.
# It is embedded into the Docker image of dolibarr/dolibarr.

#

# usage: get_env_value VAR [DEFAULT]
# ie: get_env_value 'XYZ_DB_PASSWORD' 'example'
Expand Down
7 changes: 5 additions & 2 deletions images/15.0.3-php7.4/docker-init.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/usr/bin/env php
<?php
# This script is called by the docker-run.sh script to enabled modules during Dolibarr first installation.
# It is embedded into the Docker image of dolibarr/dolibarr.

require_once '../htdocs/master.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';

Expand Down Expand Up @@ -32,9 +35,9 @@
$mods = explode(',', getenv('DOLI_ENABLE_MODULES'));
foreach ($mods as $mod) {
printf("Activating module ".$mod." ...");
try {
try {
$res = activateModule('mod' . $mod);
if ($res < 0) {
if ($res < 0) {
print(" FAILED. Unable to load module. Be sure to check the case\n");
} else {
printf(" OK\n");
Expand Down
2 changes: 1 addition & 1 deletion images/15.0.3-php7.4/docker-run.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash
# This script is run when the Docker web container is started.
# It is embedded into the Docker image of dolibarr/dolibarr.

#

# usage: get_env_value VAR [DEFAULT]
# ie: get_env_value 'XYZ_DB_PASSWORD' 'example'
Expand Down
7 changes: 5 additions & 2 deletions images/16.0.5-php8.1/docker-init.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/usr/bin/env php
<?php
# This script is called by the docker-run.sh script to enabled modules during Dolibarr first installation.
# It is embedded into the Docker image of dolibarr/dolibarr.

require_once '../htdocs/master.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';

Expand Down Expand Up @@ -32,9 +35,9 @@
$mods = explode(',', getenv('DOLI_ENABLE_MODULES'));
foreach ($mods as $mod) {
printf("Activating module ".$mod." ...");
try {
try {
$res = activateModule('mod' . $mod);
if ($res < 0) {
if ($res < 0) {
print(" FAILED. Unable to load module. Be sure to check the case\n");
} else {
printf(" OK\n");
Expand Down
2 changes: 1 addition & 1 deletion images/16.0.5-php8.1/docker-run.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash
# This script is run when the Docker web container is started.
# It is embedded into the Docker image of dolibarr/dolibarr.

#

# usage: get_env_value VAR [DEFAULT]
# ie: get_env_value 'XYZ_DB_PASSWORD' 'example'
Expand Down
7 changes: 5 additions & 2 deletions images/17.0.4-php8.1/docker-init.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/usr/bin/env php
<?php
# This script is called by the docker-run.sh script to enabled modules during Dolibarr first installation.
# It is embedded into the Docker image of dolibarr/dolibarr.

require_once '../htdocs/master.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';

Expand Down Expand Up @@ -32,9 +35,9 @@
$mods = explode(',', getenv('DOLI_ENABLE_MODULES'));
foreach ($mods as $mod) {
printf("Activating module ".$mod." ...");
try {
try {
$res = activateModule('mod' . $mod);
if ($res < 0) {
if ($res < 0) {
print(" FAILED. Unable to load module. Be sure to check the case\n");
} else {
printf(" OK\n");
Expand Down
2 changes: 1 addition & 1 deletion images/17.0.4-php8.1/docker-run.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash
# This script is run when the Docker web container is started.
# It is embedded into the Docker image of dolibarr/dolibarr.

#

# usage: get_env_value VAR [DEFAULT]
# ie: get_env_value 'XYZ_DB_PASSWORD' 'example'
Expand Down
7 changes: 5 additions & 2 deletions images/18.0.5-php8.1/docker-init.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/usr/bin/env php
<?php
# This script is called by the docker-run.sh script to enabled modules during Dolibarr first installation.
# It is embedded into the Docker image of dolibarr/dolibarr.

require_once '../htdocs/master.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';

Expand Down Expand Up @@ -32,9 +35,9 @@
$mods = explode(',', getenv('DOLI_ENABLE_MODULES'));
foreach ($mods as $mod) {
printf("Activating module ".$mod." ...");
try {
try {
$res = activateModule('mod' . $mod);
if ($res < 0) {
if ($res < 0) {
print(" FAILED. Unable to load module. Be sure to check the case\n");
} else {
printf(" OK\n");
Expand Down
2 changes: 1 addition & 1 deletion images/18.0.5-php8.1/docker-run.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash
# This script is run when the Docker web container is started.
# It is embedded into the Docker image of dolibarr/dolibarr.

#

# usage: get_env_value VAR [DEFAULT]
# ie: get_env_value 'XYZ_DB_PASSWORD' 'example'
Expand Down
7 changes: 5 additions & 2 deletions images/19.0.3-php8.2/docker-init.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/usr/bin/env php
<?php
# This script is called by the docker-run.sh script to enabled modules during Dolibarr first installation.
# It is embedded into the Docker image of dolibarr/dolibarr.

require_once '../htdocs/master.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';

Expand Down Expand Up @@ -32,9 +35,9 @@
$mods = explode(',', getenv('DOLI_ENABLE_MODULES'));
foreach ($mods as $mod) {
printf("Activating module ".$mod." ...");
try {
try {
$res = activateModule('mod' . $mod);
if ($res < 0) {
if ($res < 0) {
print(" FAILED. Unable to load module. Be sure to check the case\n");
} else {
printf(" OK\n");
Expand Down
2 changes: 1 addition & 1 deletion images/19.0.3-php8.2/docker-run.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash
# This script is run when the Docker web container is started.
# It is embedded into the Docker image of dolibarr/dolibarr.

#

# usage: get_env_value VAR [DEFAULT]
# ie: get_env_value 'XYZ_DB_PASSWORD' 'example'
Expand Down
7 changes: 5 additions & 2 deletions images/develop/docker-init.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/usr/bin/env php
<?php
# This script is called by the docker-run.sh script to enabled modules during Dolibarr first installation.
# It is embedded into the Docker image of dolibarr/dolibarr.

require_once '../htdocs/master.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';

Expand Down Expand Up @@ -32,9 +35,9 @@
$mods = explode(',', getenv('DOLI_ENABLE_MODULES'));
foreach ($mods as $mod) {
printf("Activating module ".$mod." ...");
try {
try {
$res = activateModule('mod' . $mod);
if ($res < 0) {
if ($res < 0) {
print(" FAILED. Unable to load module. Be sure to check the case\n");
} else {
printf(" OK\n");
Expand Down
2 changes: 1 addition & 1 deletion images/develop/docker-run.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash
# This script is run when the Docker web container is started.
# It is embedded into the Docker image of dolibarr/dolibarr.

#

# usage: get_env_value VAR [DEFAULT]
# ie: get_env_value 'XYZ_DB_PASSWORD' 'example'
Expand Down

0 comments on commit aadadb0

Please sign in to comment.