Add keycloak

This commit is contained in:
thomas 2022-10-16 01:39:24 +02:00
parent 82049648fe
commit 6ae50db5ac
10 changed files with 134 additions and 1 deletions

View file

@ -56,6 +56,7 @@ To enter in temporary filesystem
- [grocy](./ressources/grocy)
- [joplin desktop](./ressources/joplin)
- [joplin-server](./ressources/joplin-server)
- [keycloak](./resources/keycloak)
- [kimai2](./ressources/kimai2)
- [mautrix-syncproxy and mautrix-wsproxy](./ressources/mautrix-syncproxy)
- [mautrix-whatsapp](./ressources/mautrix-whatsapp)

View file

@ -0,0 +1,38 @@
#### keycloak
##### Information
Site : https://www.keycloak.org/
Source : https://github.com/keycloak/keycloak
##### Install
```bash
apt install -y wget ca-certificates
wget -qO - https://deb.lgy.fr/install.sh | bash
apt-get update
apt install keycloak
# edit /etc/default/keycloak
# edit /etc/keycloak/keycloak.conf
systemctl enable --now keycloak
```
##### Configuration
Create database sample on postgresql
```SQL
CREATE USER keycloak WITH PASSWORD 'password';
CREATE DATABASE "keycloak"
WITH OWNER "keycloak"
ENCODING 'UTF8'
LC_COLLATE = 'fr_FR.UTF-8'
LC_CTYPE = 'fr_FR.UTF-8'
TEMPLATE template0;
GRANT ALL privileges ON DATABASE keycloak TO keycloak;
```

41
ressources/keycloak/debmaker Executable file
View file

@ -0,0 +1,41 @@
#!/bin/bash
VERSION=19.0.1
APP=keycloak
DEPOT=https://github.com/keycloak/keycloak.git
GIT_VERSION=${VERSION}
DEB_VERSION=${VERSION}-$(date +%Y%m%d%H%M)
DEBIAN_VERSION_CODENAME=bullseye
IMAGE_SIZE=12
PACKAGE_DEPENDENCY="default-jdk maven"
STEP="base_package_upgrade install_package_dependency default_prebuild build makedeb"
#makedeb
build() {
cd /tmp/${APP}
mkdir ~/.m2/
cp .github/settings.xml ~/.m2/
cd quarkus
mvn -f ../pom.xml clean install -DskipTestsuite -DskipExamples -DskipTests
}
makedeb(){
PATH_DEB=/tmp/src/rootfs
mkdir -p ${PATH_DEB}/etc/
mkdir -p ${PATH_DEB}/usr/lib/keycloak
mkdir -p ${PATH_DEB}/var/lib/
tar -zxf /tmp/${APP}/quarkus/dist/target/keycloak-19.0.1.tar.gz -C ${PATH_DEB}/usr/lib/keycloak --strip-components=1
mv ${PATH_DEB}/usr/lib/keycloak/conf ${PATH_DEB}/etc/keycloak
#mv ${PATH_DEB}/usr/lib/keycloak/data ${PATH_DEB}/var/lib/keycloak
ln -s /etc/keycloak ${PATH_DEB}/usr/lib/keycloak/conf
ln -s /var/lib/keycloak ${PATH_DEB}/usr/lib/keycloak/data
sed -i "s/%VERSION%/$DEB_VERSION/" ${PATH_DEB}/DEBIAN/control
fakeroot dpkg-deb -Z gzip --build ${PATH_DEB} /tmp/dist
}

View file

@ -0,0 +1,2 @@
/etc/keycloak/keycloak.conf
/etc/keycloak/cache-ispn.xml

View file

@ -0,0 +1,8 @@
Package: keycloak
Version: %VERSION%
Section: base
Priority: optional
Architecture: all
Depends: default-jre
Maintainer: Thomas Legay <thomas@lgy.fr>
Description: keycloak

View file

@ -0,0 +1,6 @@
#!/bin/bash
id keycloak &> /dev/null || useradd keycloak -r -s /bin/false
chown keycloak:keycloak /var/lib/keycloak/ -R
chown keycloak:keycloak /usr/lib/keycloak/lib/quarkus -R

View file

@ -0,0 +1,5 @@
#Need to be set for the first start
#This file is reset on upgrade
#KEYCLOAK_ADMIN=admin
#KEYCLOAK_ADMIN_PASSWORD=adminpasssword

View file

@ -0,0 +1,13 @@
[Unit]
Description=keycloak
After=network.target
[Service]
User=keycloak
Group=keycloak
EnvironmentFile=/etc/default/keycloak
ExecStart=/usr/lib/keycloak/bin/kc.sh start
Restart=always
[Install]
WantedBy=multi-user.target

View file

@ -1,4 +1,4 @@
#### roundcubemail
#### kimai2
##### Information
Site : https://www.kimai.org/

View file

@ -0,0 +1,19 @@
#### mailhog
##### Information
Site : https://github.com/mailhog/MailHog
Source : https://github.com/mailhog/MailHog
##### Install
```bash
apt install -y wget ca-certificates
wget -qO - https://deb.lgy.fr/install.sh | bash
apt-get update
apt-get install -y mailhog
#edit /etc/default/mailhog
systemctl enable --now mailhog
```