pr3d4t0r/calendar

000-default.conf not found

Opened this issue · 8 comments

I've just tried to build the Baikal with Docker, but I'm keep getting this error:

apache2: Syntax error on line 219 of /etc/apache2/apache2.conf: Could not open configuration file /etc/apache2/sites-enabled/000-default.conf: No such file or directory

Some logs with additional checks:

Step 41 : RUN cat /var/www/calendar_server/Specific/virtualhosts/baikal.apache2
 ---> Using cache
 ---> ad3168ea1f92
Step 42 : RUN ln -s /var/www/calendar_server/Specific/virtualhosts/baikal.apache2 /etc/apache2/sites-available/000-default.conf
 ---> Running in 79decb847b09
 ---> df5c4a58964d
Removing intermediate container 79decb847b09
Step 43 : RUN pwd && ls -lah /etc/apache2/sites-enabled
 ---> Running in 07ebf7993fe6
/etc/apache2/sites-available
total 8.0K
drwxr-xr-x  2 root root 4.0K Oct 17 17:45 .
drwxr-xr-x 14 root root 4.0K Oct 17 17:53 ..
lrwxrwxrwx  1 root root   35 Oct 17 17:45 000-default.conf -> ../sites-available/000-default.conf
 ---> 7ee7dca4e34c
Removing intermediate container 07ebf7993fe6
Step 44 : RUN pwd && ls -lah /etc/apache2/sites-available
 ---> Running in 123d00b3a112
/etc/apache2/sites-available
total 20K
drwxr-xr-x  2 root root 4.0K Oct 17 17:53 .
drwxr-xr-x 14 root root 4.0K Oct 17 17:53 ..
lrwxrwxrwx  1 root root   61 Oct 17 17:53 000-default.conf -> /var/www/calendar_server/Specific/virtualhosts/baikal.apache2
-rw-r--r--  1 root root 6.2K Apr  5  2016 default-ssl.conf
 ---> a5f8e376072c
Removing intermediate container 123d00b3a112
Step 45 : RUN cat /etc/apache2/sites-enabled/000-default.conf
 ---> Running in bd57866756df
ServerName calendar.baikal.dev

<VirtualHost *:80>
        DocumentRoot /var/www/calendar_server/html
        ServerName calendar.baikal.dev

    RewriteEngine On
    RewriteRule /.well-known/carddav /dav.php [R,L]
    RewriteRule /.well-known/caldav /dav.php [R,L]

        <Directory "/var/www/calendar_server/html">
                Options None
                Options +FollowSymlinks
                AllowOverride All

                Require all granted
        </Directory>

</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

 ---> 29e69fb24b90
Removing intermediate container bd57866756df
Step 46 : RUN cat /etc/apache2/sites-available/000-default.conf
 ---> Running in c59d2762ee4b
ServerName calendar.baikal.dev

<VirtualHost *:80>
        DocumentRoot /var/www/calendar_server/html
        ServerName calendar.baikal.dev

    RewriteEngine On
    RewriteRule /.well-known/carddav /dav.php [R,L]
    RewriteRule /.well-known/caldav /dav.php [R,L]

        <Directory "/var/www/calendar_server/html">
                Options None
                Options +FollowSymlinks
                AllowOverride All

                Require all granted
        </Directory>

</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

During the build the file was present, possible to cat. But when I ran the container it wasn't possible to read. So I thought it's permissions issue (or symlink).

So I tried to copy the config instead of symlink

COPY    resources/baikal.apache2 /etc/apache2/sites-available/000-default.conf

BTW, this can be micro-optimization: one step instead of 2 from https://github.com/pr3d4t0r/calendar/blob/master/Dockerfile#L69 and https://github.com/pr3d4t0r/calendar/blob/master/Dockerfile#L88

Step 40 : COPY resources/baikal.apache2 /etc/apache2/sites-available/000-default.conf
 ---> dd0a43c0202d
Removing intermediate container d89c1d9b577c
Step 41 : RUN ls -lah /etc/apache2/sites-enabled
 ---> Running in 78e72f0b7ee3
total 8.0K
drwxr-xr-x  2 root root 4.0K Oct 17 17:45 .
drwxr-xr-x 14 root root 4.0K Oct 17 18:00 ..
lrwxrwxrwx  1 root root   35 Oct 17 17:45 000-default.conf -> ../sites-available/000-default.conf
 ---> 012b05e5191a
Removing intermediate container 78e72f0b7ee3
Step 42 : RUN ls -lah /etc/apache2/sites-available
 ---> Running in 99711eb51d46
total 20K
drwxr-xr-x  2 root root 4.0K Oct 17 18:00 .
drwxr-xr-x 14 root root 4.0K Oct 17 18:00 ..
-rw-rw-r--  1 root root  460 Oct 17 12:26 000-default.conf
-rw-r--r--  1 root root 6.2K Apr  5  2016 default-ssl.conf
 ---> d8aae0aa77a4
Removing intermediate container 99711eb51d46
Step 43 : RUN cat /etc/apache2/sites-enabled/000-default.conf
 ---> Running in d785f79f3f9c
ServerName calendar.baikal.dev

<VirtualHost *:80>
        DocumentRoot /var/www/calendar_server/html
        ServerName calendar.baikal.dev

    RewriteEngine On
    RewriteRule /.well-known/carddav /dav.php [R,L]
    RewriteRule /.well-known/caldav /dav.php [R,L]

        <Directory "/var/www/calendar_server/html">
                Options None
                Options +FollowSymlinks
                AllowOverride All

                Require all granted
        </Directory>

</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

 ---> f3060a816b22
Removing intermediate container d785f79f3f9c
Step 44 : RUN cat /etc/apache2/sites-available/000-default.conf
 ---> Running in 5c8c71804a00
ServerName calendar.baikal.dev

<VirtualHost *:80>
        DocumentRoot /var/www/calendar_server/html
        ServerName calendar.baikal.dev

    RewriteEngine On
    RewriteRule /.well-known/carddav /dav.php [R,L]
    RewriteRule /.well-known/caldav /dav.php [R,L]

        <Directory "/var/www/calendar_server/html">
                Options None
                Options +FollowSymlinks
                AllowOverride All

                Require all granted
        </Directory>

</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

This helped, I got rid of the error, but the next one appeared:

$ docker logs bb475ccb95c1492f6247d89b864ea92f6d0434016e9e286ae8ae7a5d2c126f40
 * Starting enhanced syslogd rsyslogd
   ...done.
 * Starting Postfix Mail Transport Agent postfix
   ...done.
AH00112: Warning: DocumentRoot [/var/www/calendar_server/html] does not exist

Fortunately this allowed me to log into the container:

$ docker exec -it bb475c bash
root@calendar:/# cd /var/www/
root@calendar:/var/www# ls
calendar_server  html
root@calendar:/var/www# cd calendar_server/
root@calendar:/var/www/calendar_server# ll
total 16
drwxrwxrwx 2 1000 1000 4096 Oct 17 12:31 ./
drwxr-xr-x 9 root root 4096 Oct 17 18:00 ../
-rw-rw-rw- 1 1000 1000    0 Oct 17 12:31 db.sqlite

No baikal files, strange.
I followed the steps in bash from the Dockerfile to download, unpack, chmod files and it worked. Strange it didn't on image build.

I'm checking the configuration again - thanks for pointing this out. I had missed your message, going over it now.

@vokiel - I just opened a new branch to address this, and produce a docker-compose.yaml file to go with the project to remove some of the startup grief.

@vokiel - I fixed the issue and added some new goodies here. The problem was a typo in the Docker run command -- I was mounting the host volume for the database in /var/www/calendar_server instead of /var/www/calendar_server/Specific/db. I addressed this by:

  1. Adding a docker-compose.yaml file for the project
  2. Updating the blog with the correct path

To run this using Docker Compose:

docker-compose up [-d] baikal

This should resolve the issue -- please check out the updates and let me know so that we can close the ticket.

Cheers!

docker-compose won't work with default settings, as the image pr3d4t0r/calendar from https://github.com/pr3d4t0r/calendar/blob/master/docker-compose.yaml#L12 is not present on Docker Hub.

I've build the image and then use it in docker-compose - it worked.

There was one issue though. I tried to use my previous database file and the permissions was not right: uid:gid was set to 1000:1000 - my local user/group. So the www-data was not able to access/write to it. But this is usual thing.

One last comment. Dockerfile could use environment variables to set the domain name in project files instead of using the resources COPY method.

Correct -- you need to set up your own Docker Hub repository for this. You can use mine if you want, but the instructions call for using your own until we sort out the 100% stand alone image. There are other issues re: email relay nodes that have nothing to do with Docker nor with Baïkal/SabreDAV that prevent us from making at ready-to-run image.

Same about permissions: the set up is dependent on how you installed Docker and whether you run it as root, or under a service account, etc. Those issues are outside of the scope of the HOWTO as of today. They'll be fixed in the next release of Baikal + pr3d4t0r/calendar.

Image name issue fixed:

#5

Please confirm this is OKi so I can close the ticket.

Thanks again for your help!

Works fine. Thx!