Anonymous
Not logged in
Talk
Contributions
Log in
Request account
Rest of What I Know
Search
Editing
One Quick Way To Host A WebApp
(section)
From Rest of What I Know
Namespaces
Page
Discussion
More
More
Page actions
Read
Edit
History
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==== Docker / Podman ==== The default thing I used to do was build the Docker image on the server and just run them there. When you do that, you can use docker/podman for process management or you can use systemd to manage your docker/podman commands. I prefer using systemd because then I don't have to remember which parts are managed with systemd and which ones with docker. One thing to note with podman is that you have to fully specify the name of parent images unless you configure the default to docker.io. Fully specifying the parent images is more portable in that you just copy the Dockerfile elsewhere and it will still build. Here's an example Dockerfile for my wiki. <syntaxhighlight lang="docker"> FROM docker.io/mediawiki:latest RUN apt-get update && apt-get install -y lua5.4 sendmail COPY ./apache.conf /etc/apache2/sites-available/000-default.conf WORKDIR /var/www/html COPY custom-php.ini /usr/local/etc/php/conf.d/custom-php.ini # Copy any additional directories (extensions, skins, etc.) COPY extensions/ ./extensions/ COPY robots.txt ./robots.txt RUN ln -sf images uploads COPY LocalSettings.php ./LocalSettings.php # update if possible (so migrations etc. can run) RUN php maintenance/update.php --quick # generate the sitemap (so that google can find sub-pages) RUN php maintenance/run.php generateSitemap --compress=no --identifier=sitemap RUN cp sitemap-index-sitemap.xml sitemap.xml </syntaxhighlight> ===== Process Management ===== With docker/podman, you can just set them to restart or whatever whenever you like and things will stay perpetually running, but I like a single system for all my apps, whether docker or not, and so I use systemd to manage them. An example systemd file looks like this for a docker app: <syntaxhighlight lang="ini"> [Unit] Description=App Container After=network.target [Service] Type=simple User=ubuntu ExecStart=/usr/bin/podman run --name sub_roshangeorge_dev --mount type=bind,source=/mnt/r2/files,target=/var/www/files -e ENV="var" -p 127.0.0.1:8080:80 sub.roshangeorge.dev:latest ExecStop=/usr/bin/podman stop sub_roshangeorge_dev ExecStopPost=/usr/bin/podman rm sub_roshangeorge_dev Restart=always [Install] WantedBy=multi-user.target </syntaxhighlight> But you could just as well have a simple non-docker version (this one is a mail server not a web-app but the idea applies) <syntaxhighlight lang="ini"> [Unit] Description=Superheap RSS Service After=network.target [Service] Type=simple User=ubuntu ExecStart=/home/ubuntu/superheap/target/release/superheap serve -c /home/ubuntu/rss/superheap.json Restart=always RestartSec=5 WorkingDirectory=/home/ubuntu [Install] WantedBy=multi-user.target </syntaxhighlight> While you'll want to symlink these into either `/etc/systemd/system/sub.roshangeorge.dev.service` or `~/.config/systemd/user/sub.roshangeorge.dev.service` if you want to keep them entirely home directory constrained, you can just leave the service unit file in your repo and have it symlinked in. Because your entire repo is on the host, you can just embed all of the host configs in your repo and then appropriately symlink them.
Summary:
Please note that all contributions to Rest of What I Know are considered to be released under the Creative Commons Attribution-ShareAlike (see
Rest of What I Know:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Wiki tools
Wiki tools
Special pages
Page tools
Page tools
User page tools
More
What links here
Related changes
Page information
Page logs