Compare commits
No commits in common. "5c11a0b724bf361ba2ec7fed06abd9490b9ed245" and "98c02fe122b940f61b24830d1873d4bfccf4890f" have entirely different histories.
5c11a0b724
...
98c02fe122
4 changed files with 6 additions and 104 deletions
|
@ -1,9 +1,9 @@
|
||||||
FROM alpine:3.20
|
FROM alpine:3.20
|
||||||
|
|
||||||
RUN apk add --no-cache ikiwiki git
|
RUN apk add --no-cache ikiwiki
|
||||||
COPY . /build
|
COPY . /build
|
||||||
WORKDIR /build
|
WORKDIR /build
|
||||||
RUN ikiwiki --rebuild --setup ikiwiki.setup
|
RUN ikiwiki --refresh --setup ikiwiki.setup
|
||||||
|
|
||||||
FROM nginx:alpine
|
FROM nginx:alpine
|
||||||
COPY --from=0 /tmp/www /usr/share/nginx/html
|
COPY --from=0 /tmp/www /usr/share/nginx/html
|
||||||
|
|
16
Makefile
16
Makefile
|
@ -4,24 +4,11 @@ BROWSER=conkeror
|
||||||
#IKIWIKI=ikiwikitest.sh
|
#IKIWIKI=ikiwikitest.sh
|
||||||
IKIWIKI=ikiwiki
|
IKIWIKI=ikiwiki
|
||||||
|
|
||||||
VERSION=$(shell git describe --always)
|
|
||||||
ARGOCD_HOME=$HOME/vcs/k8s-config/cluster/p10/apps/templates/
|
|
||||||
ARGOCD_YAML=nicoweb.yaml
|
|
||||||
ARGOCD_APP=$ARGOCD_HOME/$ARGOCD_YAML
|
|
||||||
|
|
||||||
all: container
|
|
||||||
|
|
||||||
pub:
|
pub:
|
||||||
git push --mirror
|
git push --mirror
|
||||||
setup:
|
all:
|
||||||
$(IKIWIKI) --refresh --setup ikiwiki.setup
|
$(IKIWIKI) --refresh --setup ikiwiki.setup
|
||||||
|
|
||||||
container:
|
|
||||||
docker build -t harbor.k8s.ungleich.ch/nico/www.nico.schottelius.org:$(VERSION) .
|
|
||||||
docker push harbor.k8s.ungleich.ch/nico/www.nico.schottelius.org:$(VERSION)
|
|
||||||
sed -i "s,harbor.k8s.ungleich.ch/nico/www.nico.schottelius.org:.*,harbor.k8s.ungleich.ch/nico/www.nico.schottelius.org:$(VERSION)" $(ARGOCD_APP)
|
|
||||||
cd $(ARGOCD_HOME) && git add $(ARGOCD_YAML) && git commit -m "Update www.nico.schottelius.org to $(VERSION)" && git push
|
|
||||||
|
|
||||||
lall:
|
lall:
|
||||||
$(IKIWIKI) --refresh --setup ikiwiki.setup --set destdir=../dst --set srcdir=. --set git_wrapper= --set git_wrappermode= --set gitorigin_branch= --set gitmaster_branch=
|
$(IKIWIKI) --refresh --setup ikiwiki.setup --set destdir=../dst --set srcdir=. --set git_wrapper= --set git_wrappermode= --set gitorigin_branch= --set gitmaster_branch=
|
||||||
|
|
||||||
|
@ -49,3 +36,4 @@ clean: all
|
||||||
# @echo "Press return to publish..."
|
# @echo "Press return to publish..."
|
||||||
# @read avariable
|
# @read avariable
|
||||||
# git push --mirror
|
# git push --mirror
|
||||||
|
|
||||||
|
|
|
@ -1,84 +0,0 @@
|
||||||
[[!meta title="www.nico.schottelius.org now hosted in kubernetes"]]
|
|
||||||
|
|
||||||
## History
|
|
||||||
|
|
||||||
I started this website in 2008, according to the
|
|
||||||
[git log on the
|
|
||||||
2008-10-30](https://code.ungleich.ch/nico/www.nico.schottelius.org). Since
|
|
||||||
then it has been based on [ikiwiki](https://ikiwiki.info), a sample
|
|
||||||
word processor.
|
|
||||||
|
|
||||||
This website has been hosted on many different physical and virtual
|
|
||||||
servers since then. And now...
|
|
||||||
|
|
||||||
## Moving into kubernetes
|
|
||||||
|
|
||||||
It is time for its next step. When you are reading this, the website
|
|
||||||
is likely already being served by a tiny container in a larger
|
|
||||||
kubernetes cluster.
|
|
||||||
|
|
||||||
But why moving it in the first place? Isn't a static webserver running
|
|
||||||
nginx good enough?
|
|
||||||
|
|
||||||
## The ungleich infrastructure
|
|
||||||
|
|
||||||
The one or other of you knows that I work for
|
|
||||||
[ungleich](https://ungleich.ch), a Swiss Open Source company with the
|
|
||||||
focus on sustainability. The infrastructure at ungleich has been
|
|
||||||
always evolving and one of the earliest credos was to run anything
|
|
||||||
that is potentially being offered as a product ourselves. Thus any
|
|
||||||
service you can get from ungleich, is also being run internally -
|
|
||||||
anything from Matrix to Nextcloud to Mattermost to Netbox, you name
|
|
||||||
it.
|
|
||||||
|
|
||||||
## VM workloads are getting old
|
|
||||||
|
|
||||||
While there is still a significant amount of virtual machines running
|
|
||||||
at ungleich, internally most (more than 80%) of the workload has been
|
|
||||||
migrated to kubernetes a long time ago. The main advantage of
|
|
||||||
kubernetes for ungleich is to be able to run many similar services
|
|
||||||
(again such as matrix) and deploy them using
|
|
||||||
[argocd](https://argo-cd.readthedocs.io/).
|
|
||||||
|
|
||||||
While we are still using [cdist](http://cdi.st/) for configuration
|
|
||||||
management and for configuring servers (both bare metal as well as
|
|
||||||
VMs), deploying applications via kubernetes is now a well known
|
|
||||||
pattern and effectively reduces the effort.
|
|
||||||
|
|
||||||
This particular website is running on a virtual machine we internally
|
|
||||||
call "staticweb", as it only hosts statically generated websites, no
|
|
||||||
dynamic content at all.
|
|
||||||
|
|
||||||
And it has been on our "to migrate" list for about 1.5 years. So it's
|
|
||||||
time to move on...
|
|
||||||
|
|
||||||
## How to run a website in kubernetes
|
|
||||||
|
|
||||||
There are so many different ways to run applications in kubernetes,
|
|
||||||
today I want to show you a rather simple one. As I mentioned, this
|
|
||||||
website is built using ikiwiki and backed by git. It actually uses a
|
|
||||||
[Makefile](/Makefile) for a long time and since today also a
|
|
||||||
[Dockerfile](/Dockerfile) to generate its own container.
|
|
||||||
|
|
||||||
Makefiles are not always nice, but they have one very nice way of
|
|
||||||
working: if one command fails, the makefile aborts. So we can use it
|
|
||||||
essentially to:
|
|
||||||
|
|
||||||
* build the container
|
|
||||||
* upload the container
|
|
||||||
* update the argocd manifest to refer to the latest container
|
|
||||||
|
|
||||||
And each step is only executed if the previous one was successful.
|
|
||||||
|
|
||||||
Instead of using a too fancy build pipeline that runs async in some
|
|
||||||
amazing build cluster I am just executing
|
|
||||||
|
|
||||||
make
|
|
||||||
|
|
||||||
On my notebook and everything else is built & triggered and
|
|
||||||
uploaded.
|
|
||||||
|
|
||||||
If you can read this, my build was successful and this website is now
|
|
||||||
running in kubernetes.
|
|
||||||
|
|
||||||
[[!tag ikiwiki kubernetes]]
|
|
|
@ -30,7 +30,7 @@ use IkiWiki::Setup::Standard {
|
||||||
# rcs backend to use
|
# rcs backend to use
|
||||||
rcs => '',
|
rcs => '',
|
||||||
# plugins to add to the default configuration
|
# plugins to add to the default configuration
|
||||||
add_plugins => [qw{git goodstuff meta sidebar tag rawhtml flattr}],
|
add_plugins => [qw{goodstuff meta sidebar tag rawhtml flattr}],
|
||||||
|
|
||||||
flattr_userid => "telmich",
|
flattr_userid => "telmich",
|
||||||
|
|
||||||
|
@ -278,9 +278,6 @@ use IkiWiki::Setup::Standard {
|
||||||
# parent page tags are located under
|
# parent page tags are located under
|
||||||
tagbase => 'tags',
|
tagbase => 'tags',
|
||||||
|
|
||||||
# emtpy disables pull & push
|
|
||||||
gitorigin_branch => '',
|
|
||||||
|
|
||||||
# underlay plugin
|
# underlay plugin
|
||||||
# extra underlay directories to add
|
# extra underlay directories to add
|
||||||
#add_underlays => [qw{/home/users/nico/wiki.underlay}],
|
#add_underlays => [qw{/home/users/nico/wiki.underlay}],
|
||||||
|
@ -289,6 +286,7 @@ use IkiWiki::Setup::Standard {
|
||||||
|
|
||||||
# git_wrapper => '/home/services/git/nico.schottelius.org/hooks/post-update',
|
# git_wrapper => '/home/services/git/nico.schottelius.org/hooks/post-update',
|
||||||
# git_wrappermode => '06755',
|
# git_wrappermode => '06755',
|
||||||
|
# gitorigin_branch => 'origin',
|
||||||
# gitmaster_branch => 'master',
|
# gitmaster_branch => 'master',
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue