Rossonius Pun
Rossonius Pun
RRailway
Created by Rossonius Pun on 10/21/2023 in #✋|help
Volume storage not available while building from Docker image?
Alright, fewf. It does seem to at least be running and using your FileBrowser template additionally allowed copying the LocalSettings file over to the volume. It’s clumsy, but it may work. Many thanks for your help!!
44 replies
RRailway
Created by Rossonius Pun on 10/21/2023 in #✋|help
Volume storage not available while building from Docker image?
I'm interested in MediaWiki despite its design flaws (as well as learning a bit about Docker and Railway along the way) which means I need to be able to access /var/www/html on my volume. A mounted volume in Railway can only be accessed by the app after the container is running. With the default MediaWiki DockerHub image, I note that the actual MediaWiki "install" portion basically amounts to downloading a tarball using curl and extracting it into /var/www/html, something that doesn't work if that's where the volume is mounted. My work-around is to use a custom Dockerfile hosted on a private repo that is a copy of the MediaWiki file with a few key lines added. The end result is that the MW files end up untarred into a temp directory, and an executable shell script is used as the main CMD entrypoint instead of running apache. This shell script first copies all of the MW files from the temp directory into /var/www/html (which will now be the mounted volume, at "runtime" for the container), deletes the temp directory, then runs the apache server as per usual.
44 replies
RRailway
Created by Rossonius Pun on 10/21/2023 in #✋|help
Volume storage not available while building from Docker image?
Alright, I'm looking for a sanity check that this isn't overly stupid or otherwise A Real Bad Idea. It's possibly convoluted, but I can accept that. 😄
44 replies
RRailway
Created by Rossonius Pun on 10/21/2023 in #✋|help
Volume storage not available while building from Docker image?
Yeah I hear you. I'm more thinking of my own learning though because I'm seeing now I had a misapprehension about what was happening with volumes. The MediaWiki design is fair to criticize, but I presume it's likely because it came about in an era before distributed deploys like docker/railway/etc.
44 replies
RRailway
Created by Rossonius Pun on 10/21/2023 in #✋|help
Volume storage not available while building from Docker image?
I'm interacting with dockerfiles and expecting the volume stuff to be the same as with Docker, but Railway is actually doing other work like converting to nixpacks (iirc) and handling volumes mounted to services in an unrelated way.
44 replies
RRailway
Created by Rossonius Pun on 10/21/2023 in #✋|help
Volume storage not available while building from Docker image?
At least comparing (naively) Railway to running a Docker image on my own PC, this is due to a fundamental difference in how volumes are handled by Docker by default vs how Railway is implementing volumes.
44 replies
RRailway
Created by Rossonius Pun on 10/21/2023 in #✋|help
Volume storage not available while building from Docker image?
I guess that's the wrong question, really.
44 replies
RRailway
Created by Rossonius Pun on 10/21/2023 in #✋|help
Volume storage not available while building from Docker image?
So there is no way to access volumes in Railway during the build process?
44 replies
RRailway
Created by Rossonius Pun on 10/21/2023 in #✋|help
Volume storage not available while building from Docker image?
Fair, but returning to the dockerfile example above - is there a work-around to allow index.html be written into the mounted /var/www/html directory, as intended?
44 replies
RRailway
Created by Rossonius Pun on 10/21/2023 in #✋|help
Volume storage not available while building from Docker image?
Because the dockerfile above has nothing to do with mediawiki - it should, I would think, work with a volume attached,
44 replies
RRailway
Created by Rossonius Pun on 10/21/2023 in #✋|help
Volume storage not available while building from Docker image?
Ok, but treating it as such, what's the proper approach to mount and then have the mounted directory's contents affected by my image?
44 replies
RRailway
Created by Rossonius Pun on 10/21/2023 in #✋|help
Volume storage not available while building from Docker image?
Although, incidentally, I thought that mounting a volume within images would preserve the pre-existing contents.
44 replies
RRailway
Created by Rossonius Pun on 10/21/2023 in #✋|help
Volume storage not available while building from Docker image?
This also occurs when mounting the volume before building the image
44 replies
RRailway
Created by Rossonius Pun on 10/21/2023 in #✋|help
Volume storage not available while building from Docker image?
I've looked at this some more and while I can't say for certain the fault lies with Railway, I'm at a loss for what else could be the issue. Based on the mediawiki Dockerfile source used to generate their image https://github.com/wikimedia/mediawiki-docker/blob/fdf347f62615dad789d0e703fc2f6d628c43d4e1/1.40/apache/Dockerfile I've broken things down to the simplest case that results in the service not running as expected:
FROM php:8.1-apache

RUN set -eux; \
{ \
echo "<html>"; \
echo " <body><p>Hello world</p></body>"; \
echo "</body>"; \
} > "index.html"

CMD ["apache2-foreground"]
FROM php:8.1-apache

RUN set -eux; \
{ \
echo "<html>"; \
echo " <body><p>Hello world</p></body>"; \
echo "</body>"; \
} > "index.html"

CMD ["apache2-foreground"]
Using that custom Dockerfile in a new service, I am able to successfully run this on Railway and accessing the generated domain gives me the expected 'Hello world' page. However, mounting a volume to /var/www/html on that same service then trying to run with no other changes, I receive a 403-Forbidden error along with this entry in my my Deploy logs on Railway: AH01276: Cannot serve directory /var/www/html/: No matching DirectoryIndex (index.php,index.html) found, and server-generated directory index forbidden by Options directive
44 replies
RRailway
Created by Rossonius Pun on 10/21/2023 in #✋|help
Volume storage not available while building from Docker image?
This only happens on Railway though. As I mentioned, using the same image from dockerhub and running on my own PC docker run... with the same mount point gives me a working container that behaves as expected: all of the usual stuff that MediaWiki puts in /var/www/html is present and accounted for, except it's all sitting on the mounted volume. At that point I can add the LocalSettings file and know it will persist. I don't know why this isn't possible on Railway.
44 replies
RRailway
Created by Rossonius Pun on 10/21/2023 in #✋|help
Volume storage not available while building from Docker image?
😦
44 replies
RRailway
Created by Rossonius Pun on 10/21/2023 in #✋|help
Volume storage not available while building from Docker image?
And since both the images directory and the LocalSettings.php file itself are contained within /var/www/html I would have thought it sufficient for deploying on Railway (if not exactly the intention for the dockerhub image) that I optionally include a single volume mounted at /var/www/html, encapsulating both the images dir and LocalSettings file.
44 replies
RRailway
Created by Rossonius Pun on 10/21/2023 in #✋|help
Volume storage not available while building from Docker image?
I saw that docker compose file, but isn't that just an example compose file? The paragraph above specifies that the dockerhub image doesn't include any volumes.
44 replies
RRailway
Created by Rossonius Pun on 10/21/2023 in #✋|help
Volume storage not available while building from Docker image?
I’ll take you at your word that it might not be possible on Railway atm. But can you elaborate on what you mean by mediawiki needing two volumes?
44 replies
RRailway
Created by Rossonius Pun on 10/21/2023 in #✋|help
Volume storage not available while building from Docker image?
But I'm not sure how to achieve the same effect on Railway.
44 replies