Skip to content

How to deploy a FPM-based static image? #994

@andresmrm

Description

@andresmrm

Hello!

The docs says it's possible to deploy a FPM-based static image (updates-via-redeploy), but I'm a bit lost about how to do it.

I've managed to do a Caddy + Wordpress-FPM deploy sharing a volume (/var/www/html) between them. It works, but, as expected, it's not static (so it's harder to control its upgrades through image tag version).

If I try to go static image and don't use a volume to share WP's files with Caddy, how will it serve its static files (CSS, JS etc)? They seem to be spread among many folders (and if I create a volume for each of these folders, which would be annoying, it would also make harder to upgrade these files).

Not sharing WP's files with Caddy also makes it harder (impossible?) to configure it to send the correct requests to FPM to run the corresponding PHP files.

I'm using Caddy, but I think the same problems would happen with other web servers.

Any tips about all that?

Thanks for your attention!

PS: The default Caddy config for PHP decides what to do based on file existence. Without sharing a volume that won't work. I came up with this Caddy config that seems to handle some routes, but probably missing many others. Still, the static files serving problem remains and I have no idea how to reasonably solve it.

localhost {
	handle {
		root * /usr/src/wordpress

		redir /wp-login /wp-login.php
		redir /wp-admin /wp-admin/index.php

		@toRootIndex {
			not path /wp-admin/index.php
			not path /wp-login.php
		}
		rewrite @toRootIndex index.php

		reverse_proxy wordpress:9000 {
			transport fastcgi {
				split .php
				capture_stderr
			}
		}
	}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions