mirror of https://github.com/requarks/wiki
commit
d1d78e46e7
@ -1,6 +0,0 @@
|
||||
dependencies:
|
||||
- name: postgresql
|
||||
repository: https://charts.bitnami.com/bitnami
|
||||
version: 8.10.14
|
||||
digest: sha256:db7c1e0bc9ec0ed45520521bd76bb390d04711fd0f04affaadafa1dc498ce68b
|
||||
generated: "2020-07-21T20:34:41.41180748-04:00"
|
||||
Binary file not shown.
@ -0,0 +1,21 @@
|
||||
{{- if and .Values.postgresql.enabled .Values.postgresql.persistence.enabled -}}
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: {{ include "wiki.postgresql.fullname" . }}
|
||||
labels:
|
||||
{{- include "wiki.labels" . | nindent 4 }}
|
||||
spec:
|
||||
accessModes:
|
||||
- {{ .Values.postgresql.persistence.accessMode | quote }}
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .Values.postgresql.persistence.size | quote }}
|
||||
{{- if .Values.postgresql.persistence.storageClass }}
|
||||
{{- if (eq "-" .Values.postgresql.persistence.storageClass) }}
|
||||
storageClassName: ""
|
||||
{{- else }}
|
||||
storageClassName: {{ .Values.postgresql.persistence.storageClass | quote }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@ -0,0 +1,12 @@
|
||||
{{- if and .Values.postgresql.enabled (not .Values.postgresql.existingSecret) -}}
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: {{ include "wiki.postgresql.fullname" . }}
|
||||
labels:
|
||||
{{- include "wiki.labels" . | nindent 4 }}
|
||||
type: Opaque
|
||||
data:
|
||||
postgresql-password: {{ .Values.postgresql.postgresqlPassword | b64enc | quote }}
|
||||
postgresql-username: {{ .Values.postgresql.postgresqlUser | b64enc | quote }}
|
||||
{{- end }}
|
||||
@ -0,0 +1,21 @@
|
||||
{{- if .Values.postgresql.enabled -}}
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ include "wiki.postgresql.fullname" . }}
|
||||
labels:
|
||||
{{- include "wiki.labels" . | nindent 4 }}
|
||||
{{- with .Values.postgresql.service.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
type: {{ .Values.postgresql.service.type }}
|
||||
ports:
|
||||
- port: {{ .Values.postgresql.service.port }}
|
||||
targetPort: 5432
|
||||
protocol: TCP
|
||||
name: postgresql
|
||||
selector:
|
||||
{{- include "wiki.postgresql.selectorLabels" . | nindent 4 }}
|
||||
{{- end }}
|
||||
@ -0,0 +1,101 @@
|
||||
{{- if .Values.postgresql.enabled -}}
|
||||
apiVersion: apps/v1
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: {{ include "wiki.postgresql.fullname" . }}
|
||||
labels:
|
||||
{{- include "wiki.labels" . | nindent 4 }}
|
||||
spec:
|
||||
serviceName: {{ include "wiki.postgresql.fullname" . }}
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "wiki.postgresql.selectorLabels" . | nindent 6 }}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
{{- include "wiki.postgresql.selectorLabels" . | nindent 8 }}
|
||||
spec:
|
||||
{{- with .Values.postgresql.affinity }}
|
||||
affinity:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.postgresql.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.postgresql.tolerations }}
|
||||
tolerations:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: postgresql
|
||||
image: {{ .Values.postgresql.image.repository }}:{{ .Values.postgresql.image.tag }}
|
||||
imagePullPolicy: {{ .Values.postgresql.image.pullPolicy }}
|
||||
ports:
|
||||
- containerPort: 5432
|
||||
name: postgresql
|
||||
env:
|
||||
- name: POSTGRES_DB
|
||||
value: {{ .Values.postgresql.postgresqlDatabase | quote }}
|
||||
- name: POSTGRES_USER
|
||||
{{- if .Values.postgresql.existingSecret }}
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ .Values.postgresql.existingSecret }}
|
||||
key: {{ default "postgresql-username" .Values.postgresql.existingSecretUserKey | quote }}
|
||||
{{- else }}
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ include "wiki.postgresql.fullname" . }}
|
||||
key: postgresql-username
|
||||
{{- end }}
|
||||
- name: POSTGRES_PASSWORD
|
||||
{{- if .Values.postgresql.existingSecret }}
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ .Values.postgresql.existingSecret }}
|
||||
key: {{ default "postgresql-password" .Values.postgresql.existingSecretKey | quote }}
|
||||
{{- else }}
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ include "wiki.postgresql.fullname" . }}
|
||||
key: postgresql-password
|
||||
{{- end }}
|
||||
- name: PGDATA
|
||||
value: /var/lib/postgresql/data/pgdata
|
||||
livenessProbe:
|
||||
exec:
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- exec pg_isready -U {{ .Values.postgresql.postgresqlUser }} -d {{ .Values.postgresql.postgresqlDatabase }}
|
||||
initialDelaySeconds: 60
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 5
|
||||
failureThreshold: 6
|
||||
readinessProbe:
|
||||
exec:
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- exec pg_isready -U {{ .Values.postgresql.postgresqlUser }} -d {{ .Values.postgresql.postgresqlDatabase }}
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 5
|
||||
timeoutSeconds: 3
|
||||
failureThreshold: 6
|
||||
resources:
|
||||
{{- toYaml .Values.postgresql.resources | nindent 12 }}
|
||||
volumeMounts:
|
||||
- name: postgresql-data
|
||||
mountPath: /var/lib/postgresql/data
|
||||
subPath: postgresql
|
||||
volumes:
|
||||
- name: postgresql-data
|
||||
{{- if .Values.postgresql.persistence.enabled }}
|
||||
persistentVolumeClaim:
|
||||
claimName: {{ include "wiki.postgresql.fullname" . }}
|
||||
{{- else }}
|
||||
emptyDir: {}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@ -1,15 +1,18 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Scripts in this directory will be executed by cloud-init on the first boot of droplets
|
||||
# created from your image. Things ike generating passwords, configuration requiring IP address
|
||||
# or other items that will be unique to each instance should be done in scripts here.
|
||||
|
||||
# Generate PostgreSQL password
|
||||
openssl rand -base64 32 > /etc/wiki/.db-secret
|
||||
|
||||
# Start containers
|
||||
if [[ -z $DATABASE_URL ]]; then
|
||||
docker start db
|
||||
fi
|
||||
docker start wiki
|
||||
docker start wiki-update-companion
|
||||
# docker start nginx-proxy
|
||||
# docker start watchtower
|
||||
|
||||
# Remove the ssh force logout command
|
||||
sed -e '/Match User root/d' \
|
||||
-e '/.*ForceCommand.*droplet.*/d' \
|
||||
-i /etc/ssh/sshd_config
|
||||
|
||||
systemctl restart ssh
|
||||
|
||||
@ -1,17 +1,33 @@
|
||||
#!/bin/bash
|
||||
|
||||
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
|
||||
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
|
||||
apt -qqy update
|
||||
apt -qqy -o Dpkg::Options::='--force-confdef' -o Dpkg::Options::='--force-confold' install docker-ce docker-ce-cli containerd.io
|
||||
# Add Docker's official GPG key:
|
||||
sudo install -m 0755 -d /etc/apt/keyrings
|
||||
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
|
||||
sudo chmod a+r /etc/apt/keyrings/docker.asc
|
||||
|
||||
# Add the repository to Apt sources:
|
||||
sudo tee /etc/apt/sources.list.d/docker.sources <<EOF
|
||||
Types: deb
|
||||
URIs: https://download.docker.com/linux/ubuntu
|
||||
Suites: $(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}")
|
||||
Components: stable
|
||||
Signed-By: /etc/apt/keyrings/docker.asc
|
||||
EOF
|
||||
|
||||
sudo apt -qqy update
|
||||
|
||||
# Install Docker
|
||||
sudo apt -qqy install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
|
||||
|
||||
systemctl enable docker
|
||||
systemctl start docker
|
||||
|
||||
# Setup containers
|
||||
|
||||
mkdir -p /etc/wiki
|
||||
|
||||
docker network create wikinet
|
||||
docker volume create pgdata
|
||||
docker create --name=db -e POSTGRES_DB=wiki -e POSTGRES_USER=wiki -e POSTGRES_PASSWORD_FILE=/etc/wiki/.db-secret -v /etc/wiki/.db-secret:/etc/wiki/.db-secret:ro -v pgdata:/var/lib/postgresql/data --restart=unless-stopped -h db --network=wikinet postgres:11
|
||||
docker create --name=db -e POSTGRES_DB=wiki -e POSTGRES_USER=wiki -e POSTGRES_PASSWORD_FILE=/etc/wiki/.db-secret -v /etc/wiki/.db-secret:/etc/wiki/.db-secret:ro -v pgdata:/var/lib/postgresql/data --restart=unless-stopped -h db --network=wikinet postgres:17
|
||||
docker create --name=wiki -e DB_TYPE=postgres -e DB_HOST=db -e DB_PORT=5432 -e DB_PASS_FILE=/etc/wiki/.db-secret -v /etc/wiki/.db-secret:/etc/wiki/.db-secret:ro -e DB_USER=wiki -e DB_NAME=wiki -e UPGRADE_COMPANION=1 --restart=unless-stopped -h wiki --network=wikinet -p 80:3000 -p 443:3443 ghcr.io/requarks/wiki:2
|
||||
docker create --name=wiki-update-companion -v /var/run/docker.sock:/var/run/docker.sock:ro --restart=unless-stopped -h wiki-update-companion --network=wikinet ghcr.io/requarks/wiki-update-companion:latest
|
||||
|
||||
@ -1,4 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
sudo curl -L "https://github.com/docker/compose/releases/download/${docker_compose_version}/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose;
|
||||
chmod +x /usr/local/bin/docker-compose;
|
||||
@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
|
||||
ufw limit ssh
|
||||
ufw allow http
|
||||
ufw allow https
|
||||
|
||||
ufw --force enable
|
||||
|
||||
cat /dev/null > /var/log/ufw.log
|
||||
@ -1,6 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
sed -e 's|GRUB_CMDLINE_LINUX="|GRUB_CMDLINE_LINUX="cgroup_enable=memory swapaccount=1|g' \
|
||||
-i /etc/default/grub
|
||||
|
||||
update-grub
|
||||
@ -1,4 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
sed -e 's|#DOCKER_OPTS|DOCKER_OPTS|g' \
|
||||
-i /etc/default/docker
|
||||
@ -1,9 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
sudo ufw allow ssh
|
||||
sudo ufw allow http
|
||||
sudo ufw allow https
|
||||
|
||||
sudo ufw --force enable
|
||||
|
||||
cat /dev/null > /var/log/ufw.log
|
||||
@ -1,24 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
################################
|
||||
## PART: Write the application tag
|
||||
##
|
||||
## vi: syntax=sh expandtab ts=4
|
||||
|
||||
build_date=$(date +%Y-%m-%d)
|
||||
distro="$(lsb_release -s -i)"
|
||||
distro_release="$(lsb_release -s -r)"
|
||||
distro_codename="$(lsb_release -s -c)"
|
||||
distro_arch="$(uname -m)"
|
||||
|
||||
mkdir -p /var/lib/digitalocean
|
||||
|
||||
cat >> /var/lib/digitalocean/application.info <<EOM
|
||||
application_name="${application_name}"
|
||||
build_date="${build_date}"
|
||||
distro="${distro}"
|
||||
distro_release="${distro_release}"
|
||||
distro_codename="${distro_codename}"
|
||||
distro_arch="${distro_arch}"
|
||||
application_version="${application_version}"
|
||||
EOM
|
||||
@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
cat >> /etc/ssh/sshd_config <<EOM
|
||||
Match User root
|
||||
ForceCommand echo "Please wait while we get your droplet ready..."
|
||||
EOM
|
||||
Loading…
Reference in new issue