Skip to content
code of my website
Branch: v3
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
docker
lib
site
themes/alexi.ch
.gitignore
README.md
docker-compose.dev.yaml
docker-compose.prod.yaml
ecosystem.config.js
package-lock.json
package.json
server.js
site-config.template.json

README.md

alexi.ch V3 - built on my own NodeJS framework

alexi.ch V3, built on my own programmer-friendly CMS

I don't need a CMS. I don't WANT a CMS. A CMS is too restrictive. I don't fear writing HTML and code. I am a developer, at last, so I feel more comfortable writing code in an editor than clicking in a UI.

So I decided to create my own CMS, which serves my needs exactly. So pcms was born: All content on alexi.ch is served by my own, programmer-friendly neat little page delivery system.

Running alexi.ch

Note: This repo uses git lfs. Make sure you have installed git lfs for your git client!

Development

There is a pre-configured docker compose file / docker image for development. Start it with:

docker-compose -f docker-compose.dev.yaml up

If you want to run things manually, use:

  1. npm install
  2. npm run css-watch # for watching the SCSS
  3. npx pm2 ecosystem.config.js --no-daemon # (to watch interactively)

or just start the server manually:

node server.js

Production

Use the production docker container:

NODE_ENV=production docker-compose -f docker-compose.prod.yaml up -d

To update the production:

  1. update the code: git pull origin v3
  2. npm install
  3. npm build-css
  4. NODE_ENV=production docker exec -ti v3.alexi.ch npx pm2 restart alexi.ch

Push to production

The production installation git contains a post-merge hook: After the production pulls, it automatically restarts. This can be triggered by a remote ssh command:

ssh -t -p xxxx user@hal2.alexi.ch 'cd /data/webroots/v3.alexi.ch/webroot && sudo git pull origin v3'

The post-merge hook script looks like this:

#!/bin/bash

WEBROOT=/data/webroots/v3.alexi.ch/webroot
DOCKER_CONTAINER=v3.alexi.ch

echo "post-receive triggered."
cd ${WEBROOT}
echo "Executing npm install" \
&& docker exec ${DOCKER_CONTAINER} /bin/bash -c "NODE_ENV=production npm install" \
&& echo "Building assets" \
&& docker exec ${DOCKER_CONTAINER} /bin/bash -c "NODE_ENV=production npm run build-css" \
&& echo "restarting ..." \
&& docker exec ${DOCKER_CONTAINER} /bin/bash -c "NODE_ENV=production npx pm2 restart alexi.ch"

(c) Alexander Schenkel

You can’t perform that action at this time.