Problem with docker and css
Hi everyone,
we are experiencing some issues trying to run mailman3 on our server.
First, when starting docker-compose up -d the mailman-web container is not started. The log shows:
mailman-web | useradd: user 'mailman' already exists
If we start the container with docker-compose up (without -d), all containers start accurately. Are there other files integrated / processed when starting docker-compose up with -d?
Secondly, no css and javascript-elements, as well as images are embedded in the web surface. In the mailman-web log we can see they aren't found (Error 404), but trying with docker-compose exec -T mailman-web ls /opt/mailman-.../static/.../... they actually can be found.
Can anybody tell me why these problems appear and how to solve them? Any help would be highly appreciated.
Thanks & Regards, Alex Klotz
(culturebase editorial staff)
Hi Alex,
On 27 June 2017 at 05:05, Alexander Klotz <alexk@kulturserver.de> wrote:
Hi everyone,
we are experiencing some issues trying to run mailman3 on our server.
First, when starting docker-compose up -d the mailman-web container is not started. The log shows:
mailman-web | useradd: user 'mailman' already exists
This is an old issue, should be resolved now. If you use the new images with tag "0.1" or "0.1.1", that should not be a problem.
The new docker-compose files have changed to reflect that. You might have to remove the old containers to use the new image:
$ docker-compose stop $ docker-compose rm $ docker pull maxking/mailman-core:0.1 $ docker pull maxking/mailman-web:0.1 # Make sure docker-compose.yaml file uses these images instead of "latest" ones. $ docker-compose up -d
If we start the container with docker-compose up (without -d), all containers start accurately. Are there other files integrated / processed when starting docker-compose up with -d?
Secondly, no css and javascript-elements, as well as images are embedded in the web surface. In the mailman-web log we can see they aren't found (Error 404), but trying with docker-compose exec -T mailman-web ls /opt/mailman-.../static/.../... they actually can be found.
Uwsgi server running the Django inside the containers doesn't serve static files. You have to serve them directly with your web server. Configuration for Nginx looks something like this1
Can anybody tell me why these problems appear and how to solve them? Any help would be highly appreciated.
Thanks & Regards, Alex Klotz
(culturebase editorial staff)
Mailman-users mailing list mailman-users@mailman3.org https://lists.mailman3.org/mailman3/lists/mailman-users.mailman3.org/
-- thanks, Abhilash Raj
Hi Abhilash,
thanks for the info regarding the docker, we could fix this issue now.
As for the webserver, we use apache instead of nginx - our current configuration looks like this and won't work - how should we change it?
Alias /static /opt/mailman/web/static
ProxyPass / http://172.19.199.3:8000/
ProxyPassReverse / http://172.19.199.3:8000/
Thanks again, Alex
Am 27.06.17 um 18:39 schrieb Abhilash Raj:
Hi Alex,
On 27 June 2017 at 05:05, Alexander Klotz <alexk@kulturserver.de> wrote:
Hi everyone,
we are experiencing some issues trying to run mailman3 on our server.
First, when starting docker-compose up -d the mailman-web container is not started. The log shows:
mailman-web | useradd: user 'mailman' already exists
This is an old issue, should be resolved now. If you use the new images with tag "0.1" or "0.1.1", that should not be a problem.
The new docker-compose files have changed to reflect that. You might have to remove the old containers to use the new image:
$ docker-compose stop $ docker-compose rm $ docker pull maxking/mailman-core:0.1 $ docker pull maxking/mailman-web:0.1 # Make sure docker-compose.yaml file uses these images instead of "latest" ones. $ docker-compose up -d
If we start the container with docker-compose up (without -d), all containers start accurately. Are there other files integrated / processed when starting docker-compose up with -d?
Secondly, no css and javascript-elements, as well as images are embedded in the web surface. In the mailman-web log we can see they aren't found (Error 404), but trying with docker-compose exec -T mailman-web ls /opt/mailman-.../static/.../... they actually can be found.
Uwsgi server running the Django inside the containers doesn't serve static files. You have to serve them directly with your web server. Configuration for Nginx looks something like this1
Can anybody tell me why these problems appear and how to solve them? Any help would be highly appreciated.
Thanks & Regards, Alex Klotz
(culturebase editorial staff)
Mailman-users mailing list mailman-users@mailman3.org https://lists.mailman3.org/mailman3/lists/mailman-users.mailman3.org/
-- Mit freundlichen Grüßen, Alexander Klotz
(redaktion kulturserver)
mailto:alexk@kulturserver.de
Stiftung kulturserver.de gGmbH
Lothringerstraße 23 D-52062 Aachen http://ggmbh.kulturserver.de
Geschäftsführer: Wolfgang Knauff
Amtsgericht Aachen* *Handelsregister-Nr.:B 10515 Umsatzsteuer-Identifikations-Nr.:DE DE 230868040
Hi Alex,
On 28 June 2017 at 02:28, Alexander Klotz <alexk@kulturserver.de> wrote:
Hi Abhilash,
thanks for the info regarding the docker, we could fix this issue now.
As for the webserver, we use apache instead of nginx - our current configuration looks like this and won't work - how should we change it?
Alias /static /opt/mailman/web/static ProxyPass / http://172.19.199.3:8000/ ProxyPassReverse / http://172.19.199.3:8000/
Here are a few resources that might help you setting up Apache with uwsgi
https://uwsgi-docs.readthedocs.io/en/latest/Apache.html http://voorloopnul.com/blog/setting-up-django-with-apache-and-uwsgi-ubuntu-1... https://uwsgi-docs.readthedocs.io/en/latest/WebServers.html
Please share the complete configuration here if you get it working, I can add it to documentation so that others can use it too :)
Thanks again, Alex
Am 27.06.17 um 18:39 schrieb Abhilash Raj:
Hi Alex,
On 27 June 2017 at 05:05, Alexander Klotz <alexk@kulturserver.de> wrote:
Hi everyone,
we are experiencing some issues trying to run mailman3 on our server.
First, when starting docker-compose up -d the mailman-web container is not started. The log shows:
mailman-web | useradd: user 'mailman' already exists
This is an old issue, should be resolved now. If you use the new images with tag "0.1" or "0.1.1", that should not be a problem.
The new docker-compose files have changed to reflect that. You might have to remove the old containers to use the new image:
$ docker-compose stop $ docker-compose rm $ docker pull maxking/mailman-core:0.1 $ docker pull maxking/mailman-web:0.1 # Make sure docker-compose.yaml file uses these images instead of "latest" ones. $ docker-compose up -d
If we start the container with docker-compose up (without -d), all containers start accurately. Are there other files integrated / processed when starting docker-compose up with -d?
Secondly, no css and javascript-elements, as well as images are embedded in the web surface. In the mailman-web log we can see they aren't found (Error 404), but trying with docker-compose exec -T mailman-web ls /opt/mailman-.../static/.../... they actually can be found.
Uwsgi server running the Django inside the containers doesn't serve static files. You have to serve them directly with your web server. Configuration for Nginx looks something like this1
Can anybody tell me why these problems appear and how to solve them? Any
help would be highly appreciated.
Thanks & Regards, Alex Klotz
(culturebase editorial staff)
Mailman-users mailing list mailman-users@mailman3.org https://lists.mailman3.org/mailman3/lists/mailman-users.mailman3.org/
-- Mit freundlichen Grüßen, Alexander Klotz
(redaktion kulturserver)
mailto:alexk@kulturserver.de
Stiftung kulturserver.de gGmbH
Lothringerstraße 23 D-52062 Aachen http://ggmbh.kulturserver.de
Geschäftsführer: Wolfgang Knauff
Amtsgericht Aachen* *Handelsregister-Nr.:B 10515 Umsatzsteuer-Identifikations-Nr.:DE DE 230868040
-- thanks, Abhilash Raj
Hi Abhilash & everybody,
thanks for your help! We got the configuration working now, see below - proxy modules have to be loaded here to make it work.
Regards, Alex
<VirtualHost *:443> ServerAdmin webmaster@localhost ServerName mailman.example.org Alias /static /opt/mailman/web/static Alias /favicon.ico /opt/mailman/web/static/hyperkitty/img/favicon.ico ProxyPassMatch ^/static/* ! ProxyPass / http://172.19.199.3:8000/ ProxyPassReverse / http://172.19.199.3:8000/ <Directory /> Allow from all Require all granted </Directory> <Directory /opt/mailman/web/static/hyperkitty/img/> Allow from all Require all granted </Directory> ErrorLog ${APACHE_LOG_DIR}/error.log LogLevel warn CustomLog ${APACHE_LOG_DIR}/access.log combined # ssl config here ... </VirtualHost>
Am 28.06.17 um 15:11 schrieb Abhilash Raj:
Hi Alex,
On 28 June 2017 at 02:28, Alexander Klotz <alexk@kulturserver.de> wrote:
Hi Abhilash,
thanks for the info regarding the docker, we could fix this issue now.
As for the webserver, we use apache instead of nginx - our current configuration looks like this and won't work - how should we change it?
Alias /static /opt/mailman/web/static ProxyPass / http://172.19.199.3:8000/ ProxyPassReverse / http://172.19.199.3:8000/
Here are a few resources that might help you setting up Apache with uwsgi
https://uwsgi-docs.readthedocs.io/en/latest/Apache.html http://voorloopnul.com/blog/setting-up-django-with-apache-and-uwsgi-ubuntu-1... https://uwsgi-docs.readthedocs.io/en/latest/WebServers.html
Please share the complete configuration here if you get it working, I can add it to documentation so that others can use it too :)
Thanks again, Alex
Am 27.06.17 um 18:39 schrieb Abhilash Raj:
Hi Alex,
On 27 June 2017 at 05:05, Alexander Klotz <alexk@kulturserver.de> wrote:
Hi everyone,
we are experiencing some issues trying to run mailman3 on our server.
First, when starting docker-compose up -d the mailman-web container is not started. The log shows:
mailman-web | useradd: user 'mailman' already exists
This is an old issue, should be resolved now. If you use the new images with tag "0.1" or "0.1.1", that should not be a problem.
The new docker-compose files have changed to reflect that. You might have to remove the old containers to use the new image:
$ docker-compose stop $ docker-compose rm $ docker pull maxking/mailman-core:0.1 $ docker pull maxking/mailman-web:0.1 # Make sure docker-compose.yaml file uses these images instead of "latest" ones. $ docker-compose up -d
If we start the container with docker-compose up (without -d), all containers start accurately. Are there other files integrated / processed when starting docker-compose up with -d?
Secondly, no css and javascript-elements, as well as images are embedded in the web surface. In the mailman-web log we can see they aren't found (Error 404), but trying with docker-compose exec -T mailman-web ls /opt/mailman-.../static/.../... they actually can be found.
Uwsgi server running the Django inside the containers doesn't serve static files. You have to serve them directly with your web server. Configuration for Nginx looks something like this1
Can anybody tell me why these problems appear and how to solve them? Any
help would be highly appreciated.
Thanks & Regards, Alex Klotz
(culturebase editorial staff)
Mailman-users mailing list mailman-users@mailman3.org https://lists.mailman3.org/mailman3/lists/mailman-users.mailman3.org/
On 05-Jul-17 06:14, Alexander Klotz wrote:
Hi Abhilash & everybody,
thanks for your help! We got the configuration working now, see below
- proxy modules have to be loaded here to make it work.
Regards, Alex
<VirtualHost *:443> ServerAdmin webmaster@localhost ServerName mailman.example.org Alias /static /opt/mailman/web/static Alias /favicon.ico /opt/mailman/web/static/hyperkitty/img/favicon.ico ProxyPassMatch ^/static/* ! ProxyPass / http://172.19.199.3:8000/ ProxyPassReverse / http://172.19.199.3:8000/ <Directory /> Allow from all Require all granted </Directory> <Directory /opt/mailman/web/static/hyperkitty/img/> Allow from all Require all granted </Directory> ErrorLog ${APACHE_LOG_DIR}/error.log LogLevel warn CustomLog ${APACHE_LOG_DIR}/access.log combined # ssl config here ... </VirtualHost>
I'm glad you got your server working. Thank you for posting your configuration.
I see one problem with what you posted:
You probably don't mean "ProxyPassMatch ^/static/* !", but rather "ProxyPassMatch ^/static/.* !", although "ProxyPassMatch ^/static/ ! " would also be correct. (You are missing a period before the asterisk.)
The first argument to ProxyPassMatch is a regular expression: "/*" means "zero or more '/'", but you want '/' followed by anything. ".*" means "zero or more <any character>". (Including the '/' prevents something like '/staticlibrary' from matching.) But since you don't try to match anything after the '/', the '.*' is unnecessary. (You'd need it for something like "^/static/.*\.(?:css|png|js)$", where you want to match some arbitrary text followed by something definite.)
Apache doesn't do a good job of documenting its regular expression syntax, so here are a couple of notes:
Apache uses the Perl Compatible Regular Expression library (with a couple of extensions). See http://www.pcre.org for full documentation; the regexps are almost exactly Perl, which is documented here: http://perldoc.perl.org/5.10.1/perlre.html. The differences are documented here: http://www.pcre.org/current/doc/html/pcre2compat.html - but unless you are an advanced regex user, you're unlikely to encounter them. The differences are with respect to Perl V5.10 (the current version of Perl is 5.26).
One of the extensions is !, which inverts the match criteria. Apache does document that.
The configuration posted is for Apache 2.4 +.
Alexander,
I will be using apache, so I'm interested in your results.
A couple of things, although "won't work" isn't a good base for diagnosis: You might tell us specifically what works, and what doesn't...
You're using an Alias for /static. One common problem is mixing Alias with ReWrite, so if you're using both, you could get confused. Although not strictly necessary, I find it less confusing to use ReWrite for everything.
I think your ProxyPass and Alias conflict. Try: Alias /static /opt/mailman/web/static ProxyPassMatch ^/static/ ! ProxyPass / http:// ...as before ProxyPassReverse / ...as before
The "ProxyPassMatch !" will prevent the ProxyPass from taking /static (the ! means "not") Note that order matters.
Other considerations:
ProxyPassReverse only rewrites URLs in Location, Content-Location and URI headers, so anything containing URLs won't be adjusted. You may need to look at mod_proxy_html. (But this won't fix external access the REST interface, which embeds URLs in JSON...)
If your site is public, I strongly recommend using TLS (SSL). If you also use TLS on between the main webserver and the backend, see also SSLProxy* directives.
Good luck.
On 28-Jun-17 05:28, Alexander Klotz wrote:
Hi Abhilash,
thanks for the info regarding the docker, we could fix this issue now.
As for the webserver, we use apache instead of nginx - our current configuration looks like this and won't work - how should we change it?
Alias /static /opt/mailman/web/static ProxyPass / http://172.19.199.3:8000/ ProxyPassReverse / http://172.19.199.3:8000/
Thanks again, Alex
participants (3)
-
Abhilash Raj
-
Alexander Klotz
-
tlhackque