Live data from Hacker News

Running Mod_Perl with Mojolicious in Docker

rawley.xyz

1–10 of 10 posts

Re: Running Mod_Perl with Mojolicious in Docker

#3
Some thoughts on the ordering of instructions in the Dockerfile:

  FROM motemen/mod_perl:5.36.0-2.4.58-2.0.13
  # Run apt first, so layers can be reused if the image is built often, do not include package lists
  RUN apt-get update -y && apt-get install -y wget make build-essential \
      && rm -rf /var/lib/apt/lists/*
  # Installing modules/packages might also be done in the beginning (as long as they don't need other files in place)
  # If you ever need something like package.json/pom.xml/Gemfile/requirements.txt etc., COPY those first)
  RUN cpan -iT Plack Mojolicious
  # Bigger dependencies that change less frequently can go first, for caching
  COPY lib /usr/local/apache2/lib
  # The rest of the configuration and app files
  COPY app.psgi /app.psgi
  COPY httpd.conf /usr/local/apache2/conf/httpd.conf
  COPY mojolicious.conf /usr/local/apache2/conf/mojolicious.conf
  EXPOSE 80
  CMD ["httpd-foreground"]
From: https://docs.docker.com/build/cache/

(probably not super important unless you're doing a lot of stuff, but sometimes useful)

Re: Running Mod_Perl with Mojolicious in Docker

#5
post #3

Some thoughts on the ordering of instructions in the Dockerfile: FROM motemen/mod_perl:5.36.0-2.4.58-2.0.13 # Run apt first, so layers can be reused if the image is built often, do not include package lists RUN apt-get update -y && apt-get install -y wget make build-essential \ && rm -rf /var/lib/apt/lists/* # Installing modules/packages might also be done in the beginning (as long as they don't need other files in p…

Very helpful. I tend to re-run "docker build" a lot when I'm figuring stuff out. In those cases ordering can make a big difference.

Re: Running Mod_Perl with Mojolicious in Docker

#7
post #6
post #2

I would definitely label this Docker image something like Party_like_its_1999

Actually this setup uses Plack, a framework whose first version was released in 2009.

What are the reasons to use mod_perl in 2023? Plack FastCGI behind nginx looks like a better option.

Re: Running Mod_Perl with Mojolicious in Docker

#8
post #6

Earlier quoted context omitted.

Actually this setup uses Plack, a framework whose first version was released in 2009.

What are the reasons to use mod_perl in 2023? Plack FastCGI behind nginx looks like a better option.

Article writer here.

A lot of our CI/CD is designed around mod_perl, and in-place updates. We run NewRelic configured to monitor Apache, which stops us from having to roll our own NewRelic connection through a CPAN module that we'd have to audit. In general for our needs, I actually believe mod_perl is superior to (F)CGI or a PSGI server reverse proxy.

Re: Running Mod_Perl with Mojolicious in Docker

#9
post #6

Earlier quoted context omitted.

Actually this setup uses Plack, a framework whose first version was released in 2009.

What are the reasons to use mod_perl in 2023? Plack FastCGI behind nginx looks like a better option.

Mod_perl was really tied into Apache. You could basically script the web server internals at a completely different level then (f)CGI and friends. In contrast, (f)CGI emphasizes a clean interface between different (os) processes. Both has its reasons to exist.

Re: Running Mod_Perl with Mojolicious in Docker

#10

Earlier quoted context omitted.

What are the reasons to use mod_perl in 2023? Plack FastCGI behind nginx looks like a better option.

Article writer here. A lot of our CI/CD is designed around mod_perl, and in-place updates. We run NewRelic configured to monitor Apache, which stops us from having to roll our own NewRelic connection through a CPAN module that we'd have to audit. In general for our needs, I actually believe mod_perl is superior to (F)CGI or a PSGI server reverse proxy.

I'm really interested in what you are building at your company.