Getting all the development dependencies and a working copy for LedgerSMB can be time consuming and complex. However, using our Docker Compose infrastructure reduces this to four simple steps:
- Install Docker
- Install Docker Compose
- Clone the LedgerSMB repository from GitHub
- Clone the LedgerSMB Development Docker repository from GitHub
(And start the infrastructure from the docker compose file.)
Example
The example below works on Debian Stretch:
Install Docker
$ sudo apt-get install \ apt-transport-https \ ca-certificates \ curl \ gnupg2 \ software-properties-common $ curl -fsSL https://download.docker.com/linux/$(. /etc/os-release; echo "$ID")/gpg | sudo apt-key add - $ sudo add-apt-repository \ "deb [arch=amd64] https://download.docker.com/linux/$(. /etc/os-release; echo "$ID") \ $(lsb_release -cs) \ stable" $ sudo apt-get update $ sudo apt-get install docker-ce
Install Docker Compose
Check the latest release at https://github.com/docker/compose/releases/ (and replace 1.17.0 with it)
$ sudo curl -L https://github.com/docker/compose/releases/download/1.17.0/docker-compose-`uname -s`-`uname -m` \ -o /usr/local/bin/docker-compose $ sudo chmod +x /usr/local/bin/docker-compose
Install docker compose bash completion (optional)
$ sudo curl -L https://raw.githubusercontent.com/docker/compose/1.17.0/contrib/completion/bash/docker-compose \ -o /etc/bash_completion.d/docker-compose
Clone the LedgerSMB repository from GitHub (checks out 'master' branch)
$ git clone https://github.com/ledgersmb/LedgerSMB.git ledgersmb $ git submodule update --init --recursive
Clone the LedgerSMB Development Docker repository from GitHub
$ git clone https://github.com/ledgersmb/ledgersmb-dev-docker.git lsmb-dev-docker
Pull the latest infrastructure from Docker Hub using Docker Compose
$ LSMB_DEV_VERSION=master docker-compose -f ../lsmb-dev-docker/docker-compose.yml pull
At this point you are set up to start developing and testing LedgerSMB; in order to test your changes in a running LedgerSMB instance, run:
$ cd ledgersmb $ lSMB_DEV_VERSION=master docker-compose -f ../lsmb-dev-docker/docker-compose.yml up -d
This command starts the container infrastructure (using the names "lsmb-master-devel" and "postgres-lsmb-master-devel" for the LedgerSMB and PostgreSQL containers respectively), taking the sources in the current directory (ledgersmb) to run the application.
Notes
File permissions
You may run into problems with file permissions if you want to run commands inside the containers which try to modify your local repository. You will need to either recursively set the file ownership to this user in your local tree, assign liberal 0777 (directory) and 0666 (file) permissions or execute the commands inside the container as root.
Example using www-data user, after you fix your file permissions:
docker exec -ti lsmb-master-devel bash www-data@90451823cb57:/srv/ledgersmb$ make dojo
Example using root inside the container:
docker exec -ti --user=root lsmb-master-devel bash
Cache issues
The container is set up with template caching enabled. This means that you'll need to restart the container after code changes to see them. This is a simple:
$ LSMB_DEV_VERSION=master docker-compose -f ../lsmb-dev-docker/docker-compose.yml restart
Supported versions
At the time of writing (November 2017), the development container infrastructure only supports development of 1.5 and never versions of LedgerSMB.
Enjoy!
How to get this running on the internet
When I follow the guidelines above the starting page does not load.
http://[my ip address]:5762/setup.pl
What do I have to do to make this show on the internet?
Make it work on the internet
Hi Yuri,
You're probably better off using the production level Docker images (tagged 1.5) to run your LedgerSMB than running the development setup, unless you want to start developing the software itself (which we would highly welcome and appreciate!). In any case, you probably shouldn't be exposing development level code on the internet.
That said, I'm using our nginx example reverse proxy configuration (with SSL certificates from letsencrypt/certbot) to forward traffic from my public IP and "https port" to the internal Docker address. If you want to find out what the IP address of your docker image is:
which means that this bit from the proxy configuration file:
Becomes: