add_mattermost (#1)
Reviewed-on: #1 Co-authored-by: Arjun Hemrajani <arjun@excloud.in> Co-committed-by: Arjun Hemrajani <arjun@excloud.in>
This commit was merged in pull request #1.
This commit is contained in:
89
mattermost/install.sh
Normal file
89
mattermost/install.sh
Normal file
@@ -0,0 +1,89 @@
|
||||
#!/bin/bash
|
||||
|
||||
APP_NAME="mattermost"
|
||||
APP_DIR="/var/excloud/apps"
|
||||
SCRIPT_DIR="/var/excloud/scripts"
|
||||
APP_UPSTREAM_PORT="${EXC_APP_UPSTREAM_PORT:-8065}"
|
||||
CALLS_PORT="${EXC_APP_CALLS_PORT:-8443}"
|
||||
|
||||
mkdir -p "${APP_DIR}"
|
||||
mkdir -p "${SCRIPT_DIR}"
|
||||
|
||||
DOMAIN="${1}"
|
||||
|
||||
if [ -z "${DOMAIN}" ]; then
|
||||
echo "Error: URL argument is required. Example:" >&2
|
||||
echo "install.sh sub.example.com" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
MATTERMOST_DIR="${APP_DIR}/${APP_NAME}"
|
||||
COMPOSE_FILE="${MATTERMOST_DIR}/docker-compose.yml"
|
||||
ENV_FILE="${MATTERMOST_DIR}/.env"
|
||||
|
||||
mkdir -p "${MATTERMOST_DIR}"
|
||||
source /var/excloud/scripts/caddy-setup.sh
|
||||
setup_initializing_page "$DOMAIN" "$APP_NAME" "$MATTERMOST_DIR"
|
||||
|
||||
if [ ! -f "${ENV_FILE}" ]; then
|
||||
POSTGRES_PASSWORD="$(od -An -N32 -tx1 /dev/urandom | tr -d ' \n')"
|
||||
(umask 077 && printf 'POSTGRES_PASSWORD=%s\n' "${POSTGRES_PASSWORD}" > "${ENV_FILE}")
|
||||
fi
|
||||
|
||||
cat > "${COMPOSE_FILE}" <<EOF
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:18-alpine
|
||||
restart: always
|
||||
security_opt:
|
||||
- no-new-privileges:true
|
||||
environment:
|
||||
POSTGRES_DB: mattermost
|
||||
POSTGRES_USER: mattermost
|
||||
POSTGRES_PASSWORD: \${POSTGRES_PASSWORD}
|
||||
TZ: UTC
|
||||
volumes:
|
||||
- mattermost-postgres-data:/var/lib/postgresql
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U mattermost -d mattermost"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 10
|
||||
|
||||
mattermost:
|
||||
image: mattermost/mattermost-team-edition:11.7.0
|
||||
restart: always
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
security_opt:
|
||||
- no-new-privileges:true
|
||||
ports:
|
||||
- "127.0.0.1:${APP_UPSTREAM_PORT}:8065"
|
||||
- "${CALLS_PORT}:8443/tcp"
|
||||
- "${CALLS_PORT}:8443/udp"
|
||||
environment:
|
||||
TZ: UTC
|
||||
MM_SQLSETTINGS_DRIVERNAME: postgres
|
||||
MM_SQLSETTINGS_DATASOURCE: postgres://mattermost:\${POSTGRES_PASSWORD}@postgres:5432/mattermost?sslmode=disable&connect_timeout=10
|
||||
MM_BLEVESETTINGS_INDEXDIR: /mattermost/bleve-indexes
|
||||
MM_SERVICESETTINGS_SITEURL: https://${DOMAIN}
|
||||
volumes:
|
||||
- mattermost-config:/mattermost/config
|
||||
- mattermost-data:/mattermost/data
|
||||
- mattermost-logs:/mattermost/logs
|
||||
- mattermost-plugins:/mattermost/plugins
|
||||
- mattermost-client-plugins:/mattermost/client/plugins
|
||||
- mattermost-bleve-indexes:/mattermost/bleve-indexes
|
||||
|
||||
volumes:
|
||||
mattermost-postgres-data:
|
||||
mattermost-config:
|
||||
mattermost-data:
|
||||
mattermost-logs:
|
||||
mattermost-plugins:
|
||||
mattermost-client-plugins:
|
||||
mattermost-bleve-indexes:
|
||||
EOF
|
||||
|
||||
bash "${SCRIPT_DIR}/domain.sh" "${DOMAIN}"
|
||||
Reference in New Issue
Block a user