aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjaseg <code@jaseg.net>2021-08-16 13:45:05 +0200
committerjaseg <code@jaseg.net>2021-08-16 13:45:05 +0200
commit514af66cc3cfa44bc6dca98c625647a698f7f9cf (patch)
treed9be20a9405fa0cfc31d9c9d2b399b29ffcce9fa
parentf698d78c4c33a39ee00117c921a747b583b009fd (diff)
downloadinfra-514af66cc3cfa44bc6dca98c625647a698f7f9cf.tar.gz
infra-514af66cc3cfa44bc6dca98c625647a698f7f9cf.tar.bz2
infra-514af66cc3cfa44bc6dca98c625647a698f7f9cf.zip
Add auto-deploy for blog.jaseg.de
-rw-r--r--gitolite-site-deploy-hook.sh8
-rw-r--r--gitolite.rc4
-rw-r--r--setup_git.yml24
-rw-r--r--setup_webserver.yml7
4 files changed, 41 insertions, 2 deletions
diff --git a/gitolite-site-deploy-hook.sh b/gitolite-site-deploy-hook.sh
new file mode 100644
index 0000000..2c34513
--- /dev/null
+++ b/gitolite-site-deploy-hook.sh
@@ -0,0 +1,8 @@
+#!/bin/sh
+echo "[deploy] Checking out static files to blog.jaseg.de webdir..."
+echo -n "Checkout is initialized: "
+env GIT_WORK_TREE=/var/www/blog.jaseg.de git rev-parse --is-inside-work-tree || git worktree add --detach /var/www/blog.jaseg.de deploy
+umask 0002
+env GIT_WORK_TREE=/var/www/blog.jaseg.de git checkout -f deploy
+git symbolic-ref HEAD refs/head/main
+echo "[deploy] done."
diff --git a/gitolite.rc b/gitolite.rc
index 2c1169b..c94cbdf 100644
--- a/gitolite.rc
+++ b/gitolite.rc
@@ -74,7 +74,7 @@
# suggested locations for site-local gitolite code (see cust.html)
# this one is managed directly on the server
- # LOCAL_CODE => "$ENV{HOME}/local",
+ LOCAL_CODE => "$ENV{HOME}/local",
# or you can use this, which lets you put everything in a subdirectory
# called "local" in your gitolite-admin repo. For a SECURITY WARNING
@@ -164,7 +164,7 @@
# 'cgit',
# allow repo-specific hooks to be added
- # 'repo-specific-hooks',
+ 'repo-specific-hooks',
# performance, logging, monitoring...
diff --git a/setup_git.yml b/setup_git.yml
index 2f4c59f..4cad914 100644
--- a/setup_git.yml
+++ b/setup_git.yml
@@ -108,6 +108,30 @@
group: gitolite3
mode: 0600
+- name: Create gitolite hook dir
+ file:
+ path: /var/lib/gitolite3/local/hooks/repo-specific
+ state: directory
+ owner: gitolite3
+ group: gitolite3
+ mode: 0755
+
+- name: Copy blog.jaseg.de git deployment script
+ copy:
+ src: gitolite-site-deploy-hook.sh
+ dest: /var/lib/gitolite3/local/hooks/repo-specific
+ owner: gitolite3
+ group: gitolite3
+ mode: 0755
+
+- name: Create blog content dir
+ file:
+ path: /var/www/blog.jaseg.de
+ state: directory
+ owner: nginx
+ group: gitolite3
+ mode: 0570
+
- name: Query system user account info
getent:
database: passwd
diff --git a/setup_webserver.yml b/setup_webserver.yml
index 4711ad0..552711f 100644
--- a/setup_webserver.yml
+++ b/setup_webserver.yml
@@ -24,6 +24,13 @@
- openjscad.jaseg.net
- automation.jaseg.de
+- name: Create blog content dir
+ file:
+ path: /var/www/blog.jaseg.de
+ state: directory
+ owner: nginx
+ mode: 0550
+
- name: Copy uwsgi systemd socket config
copy:
src: uwsgi-app@.socket