Docker-compose setup

Hello,

I’m attempting to set up a local demo using docker-compose.yml as provided in the zipfile in the downloads.
I have extracted the zip and run
docker-compose up
it appears the service has started because it serves an empty html file under
localhost:80
and has favicon of invoiceplane
http://localhost/index.php/setup also serves an empty html page.

Is there some guide which explains docker setup specifically?

1 Like

Hi there, welcome,

There is a chance that after setting it up correctly it still might not work.

To set it up correctly put the ivpl.local in your hosts file and in your ipconfig.php
In your ipconfig.php just replace what you have there (probably localhost) with ivpl.local

As you can see in resources/docker/nginx/invoiceplane.conf it’s probably not picking up “PHP” correctly.

That’s why you see an empty page.

I would suggest to use GitHub - InvoicePlane/InvoicePlane-Docker for now:

  • git clone (i usually clone it into ivpldock)
  • cp .env.example .env.docker
  • now tell where InvoicePlane “lives”
    So if ~/ivpldock is in /home/user/ivpldock
    and all your projects are in /home/user/projects
    Then in your .env.docker file you put ../projects (it’s already there)
  • keep the PHP version at 8.1
  • cp sites/copyme.conf.example sites/invoiceplane.conf
  • edit sites/invoiceplane.conf and make sure where it says “copyme” it says ivpl
  • this one: root /var/www/projects/copyme/public for InvoicePlane should be root /var/www/projects/ivpl
    (so without public)
  • ./starmeup.sh

Oh, I tried startmeup.sh rather than starmeup.sh, whoops.

So where fastcgi_pass php-upstream; is not working in resources/docker/nginx/invoiceplane.conf it is working in InvoicePlane-Docker (ivpldock)
For ivpldock you’ll just have to take a few extra steps to start it up.

resources/docker/nginx/invoiceplane.conf will be fixed, just not right at this moment.

After everything works you can go back to youf “localhost” if you really want

I went through the steps you described but I’m still unable to bring up the setup.

  1. I have cloned the repository https://github.com/InvoicePlane/InvoicePlane-Docker
  2. I have copied .env.example to .env.docker

I’m unclear about the path config. Currently i have files like
/home/radost/ivpldock/InvoicePlane-Docker/starmeup.sh

I assume I have to fix paths. Currently .env.docker fragment is like so

# Point to the path of your applications code on your host
APP_CODE_PATH_HOST=../projects/

# Point to where the `APP_CODE_PATH_HOST` should be in the container
APP_CODE_PATH_CONTAINER=/var/www/projects

# You may add flags to the path `:cached`, `:delegated`. When using Docker Sync add `:nocopy`
APP_CODE_CONTAINER_FLAG=:cached

# Choose storage path on your machine. For all storage systems
DATA_PATH_HOST=~/.ivpldock/data

I’m not sure how to change this.

1 Like

Where is your local install of InvoicePlane?
It it in
/home/radost/projects/invoiceplane?
I would make a directory projects in /home/radost/
and place your ivpl in there.

In that case you won’t have to change anything in your .env.docker file

If you name it invoiceplane (which i can understand)
Then you need to change the path to root in your sites/ivpl.conf

root /var/www/projects/ivpl
Should then be
root /var/www/projects/invoiceplane

Where is your local install of InvoicePlane?

I’m happy with any name and any location for now, I’m just trying to get an instance running.

My ~ is /home/radost. I run the following

  1. cd /home/radost/projects
  2. git clone git@github.com:InvoicePlane/InvoicePlane-Docker.git

Then /home/radost/projects/InvoicePlane-Docker is created and it contains starmeup.sh

Is this the setup you had in mind? I’m sorry if my questions feel very verbose.

1 Like

It’s perfectly ok.

cd /home/radost/
git clone git@github.com:InvoicePlane/InvoicePlane-Docker.git ivpldock
mkdir -p projects
cd projects
git clone git@github.com:InvoicePlane/InvoicePlane.git ivpl
cd ~/ivpldock
cp sites/copyme.conf.example sites/ivpl.conf
nano sites/ivpl.conf
replace "copyme" with "ivpl"
remove "/public" after "ivpl"
save, close nano

I would do

./buildmeup.sh
./starmeup.sh

It will keep your command “occupied”, but it will show output if things go wrong

In another terminal:

cd ~/ivpldock
./workmeup.sh

that will get you inside the workspace container so you can run composer install

You’ll probably end up in /var/www

“ivpl” is located in /var/www/projects/ivpl
Don’t forget to:

  • make copy of ipconfig.php.example to ipconfig.php
    and fill the database information

The database service (host) is called “mariadb”

  • yarn install && yarn grunt

Oh, I did not understand that I need both repos for the docker one to work.
This is not mentioned on anywhere in the InvoicePlane-Docker repository. (Maybe this is silly but I expected it to work similarly to how GitHub - overleaf/toolkit is designed).
They have a really good quickstart guide like this: toolkit/doc/quick-start-guide.md at master · overleaf/toolkit · GitHub - I’d be happy to make one for InvoicePlane-Docker if we manage to get it running.

I think Your instructions are missing a bit. When running ./buildmeup.sh I get

  "class": algorithms.Blowfish,
ERROR: Couldn't find env file: /home/radost/ivpldock/.env.docker

I did cp .env.example .env.docker. And the error I get is

ERROR: No such service: --build

Yes please, that would be awesome.

Very, very interesting
Try this instead:

docker-compose --env-file .env.docker up beanstalkd beanstalkd-console mariadb nginx php-fpm phpmyadmin redis workspace --build

If you strip the --build you’ll get basically what is ./starmeup.sh

radost@radost:~/ivpldock$ docker-compose --env-file .env.docker up beanstalkd beanstalkd-console mariadb nginx php-fpm phpmyadmin redis workspace --build
/usr/lib/python3/dist-packages/paramiko/transport.py:237: CryptographyDeprecationWarning: Blowfish has been deprecated
  "class": algorithms.Blowfish,
WARNING: The CHANGE_SOURCE variable is not set. Defaulting to a blank string.
WARNING: The IVPLDOCK_USER variable is not set. Defaulting to a blank string.
ERROR: No such service: --build
1 Like

Ok, sfrip the --build
It dhould find the containers aren’t there and then it should start building them :slight_smile:

It build some containers (this took a few minutes) and then crashed this way

/usr/lib/python3/dist-packages/paramiko/transport.py:237: CryptographyDeprecationWarning: Blowfish has been deprecated
  "class": algorithms.Blowfish,
WARNING: The CHANGE_SOURCE variable is not set. Defaulting to a blank string.
WARNING: The IVPLDOCK_USER variable is not set. Defaulting to a blank string.
Recreating 1aca3c5b227c_ivpldock_mariadb_1 ... 
Recreating 538850c35bff_ivpldock_redis_1   ... 
Recreating c38e7e68dc9a_ivpldock_docker-in-docker_1 ... 

ERROR: for 538850c35bff_ivpldock_redis_1  'ContainerConfig'

ERROR: for c38e7e68dc9a_ivpldock_docker-in-docker_1  'ContainerConfig'

ERROR: for 1aca3c5b227c_ivpldock_mariadb_1  'ContainerConfig'

ERROR: for redis  'ContainerConfig'

ERROR: for docker-in-docker  'ContainerConfig'

ERROR: for mariadb  'ContainerConfig'
Traceback (most recent call last):
  File "/usr/bin/docker-compose", line 33, in <module>
    sys.exit(load_entry_point('docker-compose==1.29.2', 'console_scripts', 'docker-compose')())
  File "/usr/lib/python3/dist-packages/compose/cli/main.py", line 81, in main
    command_func()
  File "/usr/lib/python3/dist-packages/compose/cli/main.py", line 203, in perform_command
    handler(command, command_options)
  File "/usr/lib/python3/dist-packages/compose/metrics/decorator.py", line 18, in wrapper
    result = fn(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/compose/cli/main.py", line 1186, in up
    to_attach = up(False)
  File "/usr/lib/python3/dist-packages/compose/cli/main.py", line 1166, in up
    return self.project.up(
  File "/usr/lib/python3/dist-packages/compose/project.py", line 697, in up
    results, errors = parallel.parallel_execute(
  File "/usr/lib/python3/dist-packages/compose/parallel.py", line 108, in parallel_execute
    raise error_to_reraise
  File "/usr/lib/python3/dist-packages/compose/parallel.py", line 206, in producer
    result = func(obj)
  File "/usr/lib/python3/dist-packages/compose/project.py", line 679, in do
    return service.execute_convergence_plan(
  File "/usr/lib/python3/dist-packages/compose/service.py", line 579, in execute_convergence_plan
    return self._execute_convergence_recreate(
  File "/usr/lib/python3/dist-packages/compose/service.py", line 499, in _execute_convergence_recreate
    containers, errors = parallel_execute(
  File "/usr/lib/python3/dist-packages/compose/parallel.py", line 108, in parallel_execute
    raise error_to_reraise
  File "/usr/lib/python3/dist-packages/compose/parallel.py", line 206, in producer
    result = func(obj)
  File "/usr/lib/python3/dist-packages/compose/service.py", line 494, in recreate
    return self.recreate_container(
  File "/usr/lib/python3/dist-packages/compose/service.py", line 612, in recreate_container
    new_container = self.create_container(
  File "/usr/lib/python3/dist-packages/compose/service.py", line 330, in create_container
    container_options = self._get_container_create_options(
  File "/usr/lib/python3/dist-packages/compose/service.py", line 921, in _get_container_create_options
    container_options, override_options = self._build_container_volume_options(
  File "/usr/lib/python3/dist-packages/compose/service.py", line 960, in _build_container_volume_options
    binds, affinity = merge_volume_bindings(
  File "/usr/lib/python3/dist-packages/compose/service.py", line 1548, in merge_volume_bindings
    old_volumes, old_mounts = get_container_data_volumes(
  File "/usr/lib/python3/dist-packages/compose/service.py", line 1579, in get_container_data_volumes
    container.image_config['ContainerConfig'].get('Volumes') or {}
KeyError: 'ContainerConfig'
1 Like

It’s quite an endeavour this way…

I kight have a solution for your simple docker-compose up -d within the InvoicePlane directory

Simple docker-compose up -d

in your resources/docker/invoiceplane.conf We're referring to php-upstream(or something like that forfastcgi_pass`
That isn’t present at the moment.

Try: fastcgi_pass php_fpm:9000

The php_fpm is the Docker service with PHP 8.1 on it
If it works, can you make a pull-request for it?

InvoicePlane-Docker (ivpldock)

docker ps will give you the containers that are running.
You don’t need redis.
You need to get mariadb working

Look at the version number that is in InvoicePlane
resources/docker/mariadb/Dockerfile

and copy that version number over to your .docker/mariadb/Dockerfile

Will that build?

Do you mean InvoicePlane or InvoicePlane-docker?

Try: fastcgi_pass php_fpm:9000

I don’t understand what you mean - try how? Putting it in some config file? Which one?

1 Like

The config file is `resoures/docker/nginx/invoiceplane.conf``
You need to replace 1 line with another line.
(That’s what i meant with “try”)

Simple docker-compose up -d

cd (invoiceplane directory)
Open resoures/docker/nginx/invoiceplane.conf
Find fastcgi_pass php-upstream
Replace with fastcgi_pass php-fpm:9000
docker-compose up -d

I tried your “simple docker-compose up -d” solution and it built containers fine, then started the db container and so on but nginx failed.

docker ps gives

16e51c40f069   ivpl_php          "docker-php-entrypoi…"   4 minutes ago   Up About a minute   9000/tcp                                    invoiceplane-php
e951ba8c5822   ivpl_phpmyadmin   "/docker-entrypoint.…"   4 minutes ago   Up About a minute   0.0.0.0:8081->80/tcp, [::]:8081->80/tcp     invoiceplane-dbadmin
74bec2b31a45   ivpl_db           "docker-entrypoint.s…"   4 minutes ago   Up About a minute   0.0.0.0:3306->3306/tcp, :::3306->3306/tcp   invoiceplane-db

and there was an error coming from docker

invoiceplane-nginx | 2025/02/05 13:56:15 [emerg] 1#1: host not found in upstream "php-fpm" in /etc/nginx/conf.d/invoiceplane.conf:22
invoiceplane-nginx | nginx: [emerg] host not found in upstream "php-fpm" in /etc/nginx/conf.d/invoiceplane.conf:22
1 Like

Almost there…
Make it

fastcgi_pass php:9000

If that doesn’t work, let me know.
Don’t forget to bring thd containers down and rebuild (just in case)

Still want to make that documentation?

All containers look up and running

CONTAINER ID   IMAGE             COMMAND                  CREATED       STATUS              PORTS                                        NAMES
f4d47a44870d   ivpl_nginx        "/docker-entrypoint.…"   3 hours ago   Up About a minute   0.0.0.0:80->80/tcp, :::80->80/tcp, 443/tcp   invoiceplane-nginx
16e51c40f069   ivpl_php          "docker-php-entrypoi…"   3 hours ago   Up About a minute   9000/tcp                                     invoiceplane-php
e951ba8c5822   ivpl_phpmyadmin   "/docker-entrypoint.…"   3 hours ago   Up About a minute   0.0.0.0:8081->80/tcp, [::]:8081->80/tcp      invoiceplane-dbadmin
74bec2b31a45   ivpl_db           "docker-entrypoint.s…"   3 hours ago   Up About a minute   0.0.0.0:3306->3306/tcp, :::3306->3306/tcp    invoiceplane-db

but opening
http://localhost:80
serves an empty website (but nginx is working because http://localhost/favicon.ico gives ivpl logo).

1 Like