mirror of
https://github.com/ledgersmb/ledgersmb-docker.git
synced 2025-10-14 08:10:30 -04:00
Compare commits
47 Commits
1.5.0-beta
...
1.5.14
Author | SHA1 | Date | |
---|---|---|---|
|
a22ed7ac49 | ||
|
1f1df000b8 | ||
|
fe867c9925 | ||
|
9ff64318ab | ||
|
46ae598da0 | ||
|
1387c10fd1 | ||
|
cbb3a0d843 | ||
|
0e41af2b67 | ||
|
a30d23bbb6 | ||
|
e10bd36b80 | ||
|
1a56d1523d | ||
|
aa260dcec9 | ||
|
402f541a5e | ||
|
9499b6ffc1 | ||
|
d0384889a8 | ||
|
2d4bb886f8 | ||
|
8e3f80f65f | ||
|
cd29bd895f | ||
|
42e6eb783e | ||
|
09cf2e16b7 | ||
|
2a5dff2dd7 | ||
|
e2bf781058 | ||
|
1148c219ec | ||
|
e5c6072505 | ||
|
728840ce4c | ||
|
5f45abdf2d | ||
|
8afea54d65 | ||
|
326790de44 | ||
|
c4a5359b25 | ||
|
79be91758b | ||
|
4706963a2b | ||
|
2c22bd6bbb | ||
|
d3897c8439 | ||
|
6d4d4fa927 | ||
|
8f911b4d3e | ||
|
60af8d5d49 | ||
|
2bf51fb145 | ||
|
6e41334061 | ||
|
f3f924eab9 | ||
|
e456434514 | ||
|
71de84bd9e | ||
|
262bf6e1f4 | ||
|
fdd2eed8a6 | ||
|
76c35fa0d5 | ||
|
dc0770e367 | ||
|
3839f3b105 | ||
|
9839ceaa2b |
49
Dockerfile
49
Dockerfile
@@ -1,9 +1,12 @@
|
||||
FROM perl:5
|
||||
FROM debian:jessie
|
||||
MAINTAINER Freelock john@freelock.com
|
||||
|
||||
RUN echo -n "APT::Install-Recommends \"0\";\nAPT::Install-Suggests \"0\";\n" >> /etc/apt/apt.conf
|
||||
|
||||
# Install Perl, Tex, Starman, psql client, and all dependencies
|
||||
RUN DEBIAN_FRONTENT=noninteractive && \
|
||||
apt-get update && apt-get -y install \
|
||||
# Without libclass-c3-xs-perl, performance is terribly slow...
|
||||
RUN DEBIAN_FRONTEND=noninteractive apt-get update && \
|
||||
apt-get dist-upgrade -y && apt-get -y install \
|
||||
libcgi-emulate-psgi-perl libcgi-simple-perl libconfig-inifiles-perl \
|
||||
libdbd-pg-perl libdbi-perl libdatetime-perl \
|
||||
libdatetime-format-strptime-perl libdigest-md5-perl \
|
||||
@@ -15,29 +18,40 @@ RUN DEBIAN_FRONTENT=noninteractive && \
|
||||
libpgobject-util-dbmethod-perl libplack-perl libtemplate-perl \
|
||||
libnamespace-autoclean-perl \
|
||||
libtemplate-plugin-latex-perl libtex-encode-perl \
|
||||
libmoosex-nonmoose-perl libclass-c3-xs-perl \
|
||||
texlive-latex-recommended \
|
||||
texlive-xetex \
|
||||
starman \
|
||||
libopenoffice-oodoc-perl \
|
||||
postgresql-client \
|
||||
ssmtp
|
||||
ssmtp \
|
||||
lsb-release \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
|
||||
# Build time variables
|
||||
ENV LSMB_VERSION 1.5.0-beta6
|
||||
ENV LSMB_VERSION 1.5.14
|
||||
|
||||
# Install LedgerSMB
|
||||
RUN cd /srv && \
|
||||
curl -Lo ledgersmb-$LSMB_VERSION.tar.gz https://sourceforge.net/projects/ledger-smb/files/Releases/$LSMB_VERSION/ledgersmb-$LSMB_VERSION.tar.gz/download && \
|
||||
tar -xvzf ledgersmb-$LSMB_VERSION.tar.gz
|
||||
|
||||
WORKDIR /srv/ledgersmb
|
||||
|
||||
# 1.5 requirements
|
||||
RUN cpanm --quiet --notest \
|
||||
RUN DEBIAN_FRONTEND=noninteractive apt-get update && \
|
||||
apt-get -y install git cpanminus make gcc libperl-dev && \
|
||||
curl -Lo /tmp/ledgersmb-$LSMB_VERSION.tar.gz "https://download.ledgersmb.org/f/Releases/$LSMB_VERSION/ledgersmb-$LSMB_VERSION.tar.gz" && \
|
||||
tar -xvzf /tmp/ledgersmb-$LSMB_VERSION.tar.gz --directory /srv && \
|
||||
rm -f /tmp/ledgersmb-$LSMB_VERSION.tar.gz && \
|
||||
cpanm --quiet --notest \
|
||||
--with-feature=starman \
|
||||
--with-feature=latex-pdf-ps \
|
||||
--with-feature=openoffice \
|
||||
--installdeps .
|
||||
--installdeps /srv/ledgersmb/ && \
|
||||
apt-get purge -y git cpanminus make gcc libperl-dev && \
|
||||
apt-get autoremove -y && \
|
||||
apt-get autoclean && \
|
||||
rm -rf ~/.cpanm/ && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
WORKDIR /srv/ledgersmb
|
||||
|
||||
# master requirements
|
||||
|
||||
# Configure outgoing mail to use host, other run time variable defaults
|
||||
|
||||
@@ -52,6 +66,8 @@ ENV SSMTP_FROMLINE_OVERRIDE YES
|
||||
#ENV SSMTP_AUTH_METHOD
|
||||
|
||||
ENV POSTGRES_HOST postgres
|
||||
ENV POSTGRES_PORT 5432
|
||||
ENV DEFAULT_DB lsmb
|
||||
|
||||
COPY start.sh /usr/local/bin/start.sh
|
||||
COPY update_ssmtp.sh /usr/local/bin/update_ssmtp.sh
|
||||
@@ -60,9 +76,12 @@ RUN chown www-data /etc/ssmtp /etc/ssmtp/ssmtp.conf && \
|
||||
chmod +x /usr/local/bin/update_ssmtp.sh /usr/local/bin/start.sh && \
|
||||
mkdir -p /var/www
|
||||
|
||||
# Work around an aufs bug related to directory permissions:
|
||||
RUN mkdir -p /tmp && \
|
||||
chmod 1777 /tmp
|
||||
|
||||
# Internal Port Expose
|
||||
EXPOSE 5762
|
||||
#USER www-data
|
||||
|
||||
USER www-data
|
||||
CMD ["start.sh"]
|
||||
|
147
README.md
147
README.md
@@ -1,96 +1,151 @@
|
||||
# ledgersmb-docker - EXPERIMENTAL
|
||||
# ledgersmb-docker
|
||||
Dockerfile for LedgerSMB Docker image
|
||||
|
||||
This is a work in progress to make a docker image for running LedgerSMB. It should not be relied upon for production use!
|
||||
# Supported tags
|
||||
|
||||
# Supported tags and respective `Dockerfile` links
|
||||
|
||||
- `dev-master` - Master branch from git, unstable
|
||||
- `1.5`, `1.5.x` - Latest release tarball from 1.5 branch
|
||||
- `1.4`, `latest` - Latest tagged release of git 1.4 branch
|
||||
- `1.5`, `1.5.x`, `latest` - Latest release tarball from 1.5 branch
|
||||
- `1.4`, `1.4.x` - Latest tagged release of git 1.4 branch
|
||||
- `master` - Master branch from git, unstable
|
||||
- `master-dev`, `1.5-dev` - Containers to kick off a development setup
|
||||
|
||||
|
||||
# What is LedgerSMB?
|
||||
The LedgerSMB project's priority is to provide an extremely capable yet user-friendly accounting and ERP solution to small to mid-size businesses in all locales where there is interest in using the software. The focus on small to mid-size businesses offers an opportunity to provide a positive user experience in ways which are not present in larger organizations. LedgerSMB ought to strive to be both the ideal SMB accounting/ERP package and also a solution that a start-up will never outgrow. The goals mentioned above will help us provide this ideal solution by allowing us to focus both on technical architecture and on user experience.
|
||||
|
||||
LedgerSMB is a user-friendly accounting and ERP solution for small to
|
||||
mid-size businesses. It comes with support for many languages and support
|
||||
for different locales.
|
||||
|
||||
The project aims to be the solution a start-up never outgrows.
|
||||
|
||||
|
||||
# How is this image designed to be used?
|
||||
|
||||
This Docker image is built to provide a self-contained LedgerSMB instance. To be functional, you need to connect it to a running Postgres installation. The official Postgres container will work as is, if you link it to the LedgerSMB instance at startup, or you can provide environment variables to an appropriate Postgres server.
|
||||
This image is designed to be used in conjunction with a running PostgreSQL
|
||||
instance (such as may be provided through a separate image).
|
||||
|
||||
LedgerSMB provides an http interface built on Starman out of the box, listening on port 5762. We do not recommend exposing this port, because we strongly recommend encrypting all connections using SSL/TLS. For production use, we recommend running a web server configured with SSL, such as Nginx or Apache, and proxying connections to LedgerSMB.
|
||||
This image exposes port 5762 running a Starman HTTP application server. We
|
||||
do not recommend exposing this port publicly, because
|
||||
|
||||
The other services you will need to put this in production are an SMTP gateway (set environment variables for SSMTP at container startup) and optionally a local print server (e.g. CUPS) installation. The print service is not currently supported in this Docker image, but pull requests are welcomed ;-)
|
||||
1. The Starman author recommends it
|
||||
2. We strongly recommend TLS encryption of all application traffic
|
||||
|
||||
While the exposed port can be used for quick evaluation, it's recommended
|
||||
to add the TLS layer by applying Nginx or Apache as reverse proxy.
|
||||
|
||||
Enabling optional functionalities such as outgoing e-mail and printing
|
||||
could require additional setup of a mail service or CUPS printer service.
|
||||
|
||||
# How to use this image
|
||||
|
||||
## Start a postgres instance
|
||||
|
||||
docker run --name some-postgres -e POSTGRES_PASSWORD=mysecretpassword -d postgres
|
||||
```plain
|
||||
$ docker run -d --name postgres \
|
||||
-e POSTGRES_PASSWORD=mysecretpassword \
|
||||
postgres:latest
|
||||
```
|
||||
|
||||
This image includes `EXPOSE 5432` (the postgres port), so standard container linking will make it automatically available to the linked containers. The default `postgres` user and database are created in the entrypoint with `initdb`.
|
||||
BEWARE: The command above creates a container with the database data stored
|
||||
*inside* the container. Upon removal of the container, the database data will
|
||||
be removed too!
|
||||
|
||||
> The postgres database is a default database meant for use by users, utilities and third party applications.
|
||||
> [postgresql.org/docs](http://www.postgresql.org/docs/9.3/interactive/app-initdb.html)
|
||||
To prevent destruction of the database data upon replacement of the container,
|
||||
please use these commands instead:
|
||||
|
||||
```plain
|
||||
$ docker volume create dbdata
|
||||
$ docker run -d --name postgres \
|
||||
-e POSTGRES_PASSWORD=mysecretpassword \
|
||||
-e PGDATA=/var/lib/postgresql/data/pgdata \
|
||||
-v dbdata:/var/lib/postgresql/data \
|
||||
postgres:latest
|
||||
```
|
||||
|
||||
## Start LedgerSMB
|
||||
|
||||
docker run --name myledger --link some-postgres:postgres -d ledgersmb/ledgersmb
|
||||
```plain
|
||||
$ docker run -d -p 5762:5762 --name myledger \
|
||||
ledgersmb/ledgersmb:latest
|
||||
```
|
||||
|
||||
This command maps port 5762 of your container to port 5762 in your host. The
|
||||
web application inside the container should now be accessible through
|
||||
http://localhost:5762/setup.pl.
|
||||
|
||||
## Set up LedgerSMB
|
||||
|
||||
Visit http://myledger:5762/setup.pl (you can forward port 5762 to the host machine, or lookup the IP address for the "myledger" container if running on localhost)
|
||||
* Visit http://myledger:5762/setup.pl.
|
||||
* Log in with the "postgres" user and the password `mysecretpassword`
|
||||
and provide the name of a company (= database name) you want to create.
|
||||
* Go over the steps presented in the browser
|
||||
|
||||
Log in with the "postgres" user and the password you set when starting up the Postgres container, and provide the name of a company database you want to create.
|
||||
Once you have completed the setup steps, you have a fully functional
|
||||
LedgerSMB instance running!
|
||||
|
||||
Once you have completed the setup, you have a fully functional LedgerSMB instance running!
|
||||
|
||||
Visit http://myledger:5762/login.pl to log in and get started.
|
||||
Visit http://localhost:5762/login.pl to log in and get started.
|
||||
|
||||
# Updating the LedgerSMB container
|
||||
|
||||
No persistant data is stored in the LedgerSMB container. All LedgerSMB data is stored in Postgres, so you can stop/destroy/run a new LedgerSMB container, and as long as you link it to the Postgres database, you should be able to pick up where you left off.
|
||||
No persistant data is stored in the LedgerSMB container.
|
||||
|
||||
All LedgerSMB data is stored in Postgres, so you can stop/destroy/run a
|
||||
new LedgerSMB container as often as you want.
|
||||
|
||||
# Environment Variables
|
||||
|
||||
The LedgerSMB image uses several environment variables which are easy to miss. While none of the variables are required, they may significantly aid you in using the image.
|
||||
The LedgerSMB image uses several environment variables. They are all optional.
|
||||
|
||||
### `POSTGRES_HOST` = 'postgres'
|
||||
|
||||
This environment variable is used to specify the hostname of the Postgres server. The default is "postgres", which will find the container linked in.
|
||||
## `POSTGRES_HOST`
|
||||
|
||||
If you set this to another hostname, LedgerSMB will attempt to connect to that hostname instead.
|
||||
Default: postgres
|
||||
|
||||
### `SSMTP_ROOT` `SSMTP_MAILHUB` `SSMTP_HOSTNAME` `SSMTP_USE_STARTTLS` `SSMTP_AUTH_USER` `SSMTP_AUTH_PASS` `SSMTP_METHOD` `SSMTP_FROMLINE_OVERRIDE`
|
||||
Specifies the hostname of the PostgreSQL server to connect to. If you use
|
||||
a PostgreSQL image, set it to the name of that image.
|
||||
|
||||
These variables are used to set outgoing SMTP defaults. To set the outgoing email address, set SSMTP_ROOT, and SSMTP_HOSTNAME at a minimum -- SSMTP_MAILHUB defaults to the default docker0 interface, so if your host is already configured to relay mail, this should relay successfully with only those two set.
|
||||
## `POSTGRES_PORT`
|
||||
|
||||
Use the other environment variables to relay mail through another host.
|
||||
Default: 5432
|
||||
|
||||
Port on which the PostgreSQL server is running.
|
||||
|
||||
## `DEFAULT_DB`
|
||||
|
||||
Default: lsmb
|
||||
|
||||
Set this if you want to automatically log in to a particular LedgerSMB database
|
||||
without needing to enter the name of that database on the login.pl login screen.
|
||||
|
||||
## Mail configuration
|
||||
|
||||
* `SSMTP_ROOT`
|
||||
* `SSMTP_MAILHUB`
|
||||
* `SSMTP_HOSTNAME`
|
||||
* `SSMTP_USE_STARTTLS`
|
||||
* `SSMTP_AUTH_USER`
|
||||
* `SSMTP_AUTH_PASS`
|
||||
* `SSMTP_METHOD`
|
||||
* `SSMTP_FROMLINE_OVERRIDE`
|
||||
|
||||
These variables are used to set outgoing SMTP defaults.
|
||||
|
||||
To set the outgoing email address, set `SSMTP_ROOT` and `SSMTP_HOSTNAME` at
|
||||
a minimum.
|
||||
|
||||
`SSMTP_MAILHUB` defaults to the default docker0 interface, so if your host is
|
||||
already configured to relay mail, this should relay successfully with only
|
||||
the root and hostname set.
|
||||
|
||||
Use the other environment variables to relay mail through a different host.
|
||||
|
||||
# Troubleshooting/Developing
|
||||
|
||||
You can connect to a running container using:
|
||||
Currently the LedgerSMB installation is in /srv/ledgersmb
|
||||
and the startup & config script is /usr/bin/start.sh.
|
||||
|
||||
> docker exec -ti myledger /bin/bash
|
||||
|
||||
... this will give you a shell inside the container where you can inspect/troubleshoot the installation.
|
||||
|
||||
Currently the LedgerSMB installation is in /srv/ledgersmb, and the startup/config script is /usr/bin/start.sh.
|
||||
|
||||
|
||||
# Supported Docker versions
|
||||
|
||||
This image is officially supported on Docker version 1.11.1.
|
||||
|
||||
Support for older versions is provided on a best-effort basis.
|
||||
|
||||
# User Feedback
|
||||
|
||||
## Documentation
|
||||
|
||||
This is a brand new effort, and we will be adding documentation to the http://ledgersmb.org site when we get a chance.
|
||||
|
||||
## Issues
|
||||
|
||||
If you have any problems with or questions about this image or LedgerSMB, please contact us on the [mailing list](http://ledgersmb.org/topic/support/mailing-lists-rss-and-nntp-feeds) or through a [GitHub issue](https://github.com/ledgersmb/ledgersmb-docker/issues).
|
||||
|
29
start.sh
29
start.sh
@@ -4,14 +4,25 @@ update_ssmtp.sh
|
||||
cd /srv/ledgersmb
|
||||
|
||||
if [[ ! -f ledgersmb.conf ]]; then
|
||||
cp conf/ledgersmb.conf.default ledgersmb.conf
|
||||
sed -i \
|
||||
-e "s/\(cache_templates = \).*\$/cache_templates = 1/g" \
|
||||
-e "s/\(host = \).*\$/\1$POSTGRES_HOST/g" \
|
||||
-e "s%\(sendmail = \).*%\1/usr/bin/ssmtp%g" \
|
||||
/srv/ledgersmb/ledgersmb.conf
|
||||
cat <<EOF >/tmp/ledgersmb.conf
|
||||
[main]
|
||||
cache_templates = 1
|
||||
|
||||
[database]
|
||||
host = $POSTGRES_HOST
|
||||
port = $POSTGRES_PORT
|
||||
default_db = $DEFAULT_DB
|
||||
|
||||
[mail]
|
||||
sendmail = /usr/sbin/ssmtp
|
||||
|
||||
EOF
|
||||
export LSMB_CONFIG_FILE='/tmp/ledgersmb.conf'
|
||||
fi
|
||||
|
||||
if [ ! -f "/tmp/ledgersmb" ]; then
|
||||
mkdir /tmp/ledgersmb
|
||||
fi
|
||||
# Currently unmaintained/untested
|
||||
# if [ ! -z ${CREATE_DATABASE+x} ]; then
|
||||
# perl tools/dbsetup.pl --company $CREATE_DATABASE \
|
||||
@@ -21,6 +32,7 @@ fi
|
||||
|
||||
# Needed for modules loaded by cpanm
|
||||
export PERL5LIB
|
||||
|
||||
for PerlLib in /usr/lib/perl5* /usr/local/lib/perl5*/site_perl/* ; do
|
||||
[[ -d "$PerlLib" ]] && {
|
||||
PERL5LIB="$PerlLib";
|
||||
@@ -30,4 +42,7 @@ done ;
|
||||
echo "Selected PERL5LIB=$PERL5LIB";
|
||||
|
||||
# start ledgersmb
|
||||
exec starman --port 5762 tools/starman.psgi
|
||||
# --preload-app allows application initialization to kill the entire
|
||||
# starman instance (instead of just the worker, which will immediately
|
||||
# get restarted); it also has a positive effect on memory use
|
||||
exec starman --port 5762 --preload-app tools/starman.psgi
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
ConfiguredComment='# install script update_ssmtp.sh has configured ssmtp'
|
||||
grep -qc "$ConfiguredComment" /etc/ssmtp.conf && {
|
||||
grep -qc "$ConfiguredComment" /etc/ssmtp/ssmtp.conf && {
|
||||
echo "smtp configured."
|
||||
exit
|
||||
}
|
||||
|
Reference in New Issue
Block a user