Coder Social home page Coder Social logo

bjuretko / docker-baikal-infcloud Goto Github PK

View Code? Open in Web Editor NEW
9.0 1.0 5.0 1.35 MB

CalDAV/CardDAV Server with dockerized lighthttpd + baikal + sqlite + infcloud bundle

Dockerfile 4.68% JavaScript 92.66% Makefile 0.78% Shell 1.89%
carddav-server caldav-server baikal sabredav docker synology-docker calendar addressbook

docker-baikal-infcloud's Introduction

docker-baikal-infcloud

Infcloud webinterface

Why?

  • self-hosted on synology NAS: Synology does not provide an out-of-box solution. There is the CardDAV Servr, the WebDAV Server. now even a Calendar Service with integrated web frontend (but without adressbook). The cons: many spreaded packages and services, with rather old dependencies. You cannot set seperate user/credentials for the DAV access which is not soa from a security standpoint as 2fa are not possible and simple basic auth mechanisms may leak.
  • Alternatives like owncloud/nextcloud or other colaboration suites are too much for this simple usecase
  • Using baikal for several years without any bigger issues makes it pretty robust for family or internal small company/team management.
  • You do not need email or other shared services
  • Widely supported clients, unfortunetly not natively with Android.
  • create backups of calendar and contact data
  • Syncs well with Windows, MacOS, Android and iOS

I use this setup for personal management with the family. As we used it for several years, this project is supporting my migration from a DS213j to DS718+ with Docker. Still not that easy to convince everybody to use cloud ☁︎ services 🤷🏻‍.

Build and Run

Build docker image

To build the Docker image just call

make

You can provide additional arguments to the docker command like

make args=--no-cache

to export the image as a tarball:

make export

See Makefile for more information.

Run

With sqlite

First build the image. Then call

make run

And point your Browser http://localhost:8800/baikal/html/admin/ to configure baikal.

To start the container detached (background) exec

make run args="--restart always --detach"

With mysql

To start baikal with mariadb (mysql) backend you can use the provided docker-compose file.

You need docker, docker-compose installed. The path ./baikal/db must be writable.

docker-compose up

Note:

You can use env-vars for the mysql setup, see ./docker-compose.yml file.

Visit http://localhost:8800/baikal/html/admin/ to configure baikal.

Timezone

You can change the timezone of the container on build-time via the docker build --build-arg TIMEZONE=Europe/Berlin ... command-line option or set the timezone in the Makefile

Default config

Autodiscovery

You can support easy mail-style ([email protected]) setup by with configuring service discovery features as described. here.

The docker container contains these redirects setup already.

HTTPs / SSL / TLS

The current setup does not support https directly and suppose an existing reverse proxy (e.g. https://traefik.io)

Related projects

There are some other projects related to this topic, but I couldnt find one using latest Alpine with php7 and a small httpd having a small footprint eventually running it with sqlite.

Synology

Look here for setup instructions on a Synology NAS.

docker-baikal-infcloud's People

Contributors

bjuretko avatar jezz3 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

docker-baikal-infcloud's Issues

Dokumentation

Shouldnt it say make run args="--restart always --detach" for detached start ?

Linking with host MySQL

I try to link this with my already existing host MySQL database. However, whenever I try to bind the volume /usr/builtin/var/lib/mysql:/var/lib/mysql, I get the following error on the admin page:

Exception: Fatal error: no connection to a database is available. in /var/www/baikal/Core/Frameworks/Baikal/Core/Tools.php:67
Stack trace:
#0 /var/www/baikal/Core/Frameworks/Baikal/Framework.php(80): Baikal\Core\Tools::assertBaikalIsOk()
#1 /var/www/baikal/Core/Frameworks/BaikalAdmin/Framework.php(35): Baikal\Framework::bootstrap()
#2 /var/www/baikal/html/admin/index.php(53): BaikalAdmin\Framework::bootstrap()
#3 {main}

lighttpd.conf failed build

Trying to rebuild this and getting this strange error:

 ---> Using cache
 ---> e4c07d6f4b64
Step 11/18 : COPY lighttpd.conf /etc/lighttpd/lighttpd.conf
ERROR: Service 'baikal' failed to build: COPY failed: stat /volume1/.@plugins/AppCentral/docker-ce/docker_lib/tmp/docker-builder235021056/lighttpd.conf: no such file or directory

It always tries to copy into a different folder, which is based on the docker-compose.yaml read-only, and the file is just not there. I followed all the steps in the tutorial.

Add to hub.docker.com?

Any chance adding the latest version to hub.docker.com? It would make the deployment and update through portainer easier.

Setup instructions for Synology DSM

Update readme with setup instructions

  • Add notes on image build (dev, build from git repo, tagging, export)

  • Add notes for well-known redirects

  • Notes on DAVx5 for Android

  • Settings of docker container and volume

  • Reverse Proxy setup on DSM to use https (TLS)

  • Firewall settings to close Port 8800 from the container for outbound connections

  • Backup of shared volume data

Improve README

  • Add introduction (why this and not google calendar or synology calendar package etc.)
  • Provide info about used versions of infcloud, alpine, baikal ...
  • Provide URL to latest built image
  • Add instructions for docker-only / docer-compose
  • Add instructions for running with mysql instead of sqlite
  • Add notes for https (TLS)
  • Add references to alternative projects
  • Add screenshots of infcloud
  • Add example setup for synology NAS
  • Add https://github.com/bambocher/docker-baikal

Support php7

See branch chore/support-php7 for the current status. I currently got an error when adding new calenders for users to baikal:

PDOException: SQLSTATE[HY000]: General error: 1 table calendars has no column named principaluri in /var/www/baikal/Core/Frameworks/Flake/Core/Database.php:180
Stack trace:
#0 /var/www/baikal/Core/Frameworks/Flake/Core/Database.php(180): PDO->query('INSERT INTO cal...')
#1 /var/www/baikal/Core/Frameworks/Flake/Core/Database.php(40): Flake\Core\Database->query('INSERT INTO cal...')
#2 /var/www/baikal/Core/Frameworks/Flake/Core/Model/Db.php(91): Flake\Core\Database->exec_INSERTquery('calendars', Array)
#3 /var/www/baikal/Core/Frameworks/Baikal/Model/User.php(160): Flake\Core\Model\Db->persist()
#4 /var/www/baikal/Core/Frameworks/Formal/Form.php(226): Baikal\Model\User->persist()
#5 /var/www/baikal/Core/Frameworks/BaikalAdmin/Controller/Users.php(193): Formal\Form->execute()
#6 /var/www/baikal/Core/Frameworks/BaikalAdmin/Controller/Users.php(40): BaikalAdmin\Controller\Users->actionNew()
#7 /var/www/baikal/Core/Frameworks/Flake/Core/Render/Container.php(62): BaikalAdmin\Controller\Users->execute()
#8 /var/www/baikal/Core/Frameworks/Flake/Controller/Page.php(83): Flake\Core\Render\Container->execute()
#9 /var/www/baikal/Core/Frameworks/BaikalAdmin/WWWRoot/index.php(92): Flake\Controller\Page->render()
#10 {main} 

The column principaluri of table calendars is missing in the database. See
image

Same problem arises with mysql (see docker-compose.yml - you need to uncomment mysql service).
Adding adressbooks is fine, users are added as well...

maybe you have an Idea?

Originally posted by @bjuretko in #1 (comment)

Traefik configuration

I am trying to setup Traefik to work with docker-baikal-infcloud, following the docker-compose script in this repo. I am changing the ports to 8800, but I cannot make it work. This is my modified docker-compose script for traefik:

version: "2"
services:
  traefik:
    image: traefik:1.7-alpine
    restart: always
    ports:
      - "8888:8888"
    volumes:
      - /etc/ssl/private/acme.json:/acme.json
      - /var/run/docker.sock:/var/run/docker.sock
    command:
      - --defaultentrypoints=http,https
      - --entrypoints=Name:http Address::8888 TLS Redirect.EntryPoint:https
      - --entrypoints=Name:https Address::8800
      # - --accesslog
      - --acme
      # - --acme.acmelogging
      # Staging CA server for testing/demo purposes
      # - --acme.caserver=https://acme-staging-v02.api.letsencrypt.org/directory
      - [email protected]
      - --acme.entrypoint=https
      - --acme.httpchallenge
      - --acme.httpchallenge.entrypoint=http
      - --acme.onhostrule=true
      - --acme.storage=/acme.json
      - --docker

When I go to https://host.com:8888/baikal/html/admin/ it does make an HTTPS connection and I have to accept the certificates but then redirects me to plain HTTP. It seems this is very close to be a working Traefik docker that could be very useful with this repo.

Error 403 when accessing baikal admin page

I am getting error 403 when accessing http://localhost:8800/baikal/html/admin/ . It seems that the directory has been made as admin, while the docker does not have such priviledges. Deleting and re-creating the WEBROOT/docker-baikal-infcloud/baikal solved it.

The same is happening when creating the database:

Validation error
The FOLDER containing the DB file is not writable, and it has to.
Please give write permissions on folder /var/www/baikal/Specific/db

This make me think, would it be possible to build and also run it with GID 100 UID 1000 by default, setting it in ENV?

Improve Dockerfile

  • Add USER directives and pfork lighttpd
  • support Timezone TZ setting
  • set cgi.fix_pathinfo=0 in php.ini
  • Port exposure
  • Volumes

Error during building

Tried to build it again, receiving many errors. Could you help maybe?

  php7-mbstring (missing):
    required by: world[php7-mbstring]
  php7-mysqli (missing):
    required by: world[php7-mysqli]
  php7-openssl (missing):
    required by: world[php7-openssl]
  php7-pdo (missing):
    required by: world[php7-pdo]
  php7-pdo_mysql (missing):
    required by: world[php7-pdo_mysql]
  php7-pdo_sqlite (missing):
    required by: world[php7-pdo_sqlite]
  php7-session (missing):
    required by: world[php7-session]
  php7-sqlite3 (missing):
    required by: world[php7-sqlite3]
  php7-xml (missing):
    required by: world[php7-xml]
  php7-xmlreader (missing):
    required by: world[php7-xmlreader]
  php7-xmlwriter (missing):
    required by: world[php7-xmlwriter]
  sqlite (missing):
    required by: world[sqlite]
  su-exec (missing):
    required by: world[su-exec]
  tzdata (missing):
    required by: world[tzdata]
  unzip (missing):
    required by: world[unzip]
  wget (missing):
    required by: world[wget]
The command '/bin/sh -c apk --no-cache update && apk --no-cache upgrade   && apk --no-cache add wget ca-certificates unzip lighttpd sqlite tzdata su-exec   php7-cgi php7-sqlite3 php7-dom   php7-openssl php7-pdo php7-pdo_sqlite php7-xml php7-xmlreader php7-xmlwriter php7-json   php7-pdo_mysql php7-mysqli php7-ctype php7-session php7-mbstring   && cp /usr/share/zoneinfo/${TIMEZONE} /etc/localtime   && echo ${TIMEZONE} > /etc/timezone && date   && wget -O baikal.zip -q ${URL_BAIKAL} && unzip baikal.zip -d ${WEBROOT}/ && rm baikal.zip   && wget -O infcloud.zip -q ${URL_INFCLOUD} && unzip infcloud.zip -d ${WEBROOT}/ && rm infcloud.zip   && apk del -rf --purge unzip wget ca-certificates tzdata   && sed -ie "s/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=1/g" /etc/php7/php.ini   && mkdir ${WEBROOT}/.well-known' returned a non-zero code: 22

`make` command not available

I cannot run make on my NAS (asustor) as I do not have any. Therefore the following command does not build the docker:

To build the Docker image just call

make

Before, you had the following command listed as well:

build --tag "alpine-infcloud-baikal:3.5-0.13.1-0.4.6" --tag "alpine-infcloud-baikal:latest" .

Why did you delete it? It was the only method to build the docker image for me.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.