config.sh update
This commit is contained in:
parent
77d62ba2a3
commit
9b85d33ed8
1
.gitignore
vendored
1
.gitignore
vendored
@ -2,6 +2,7 @@
|
||||
|
||||
# .env files
|
||||
.env
|
||||
.env*
|
||||
|
||||
# code-server directories
|
||||
configs/code-server/.config/code-server/*
|
||||
|
150
config.sh
150
config.sh
@ -23,22 +23,20 @@ ENV_FILE="$SCRIPT_DIR/.env"
|
||||
|
||||
echo "Looking for .env file at: $ENV_FILE"
|
||||
|
||||
# Check if .env file exists
|
||||
# Initialize a new .env file if it doesn't exist
|
||||
if [ ! -f "$ENV_FILE" ]; then
|
||||
echo "Error: .env file not found at $ENV_FILE"
|
||||
echo "Creating a backup plan - searching for .env in current directory..."
|
||||
|
||||
if [ -f ".env" ]; then
|
||||
ENV_FILE=".env"
|
||||
echo "Found .env in current directory. Using: $ENV_FILE"
|
||||
else
|
||||
echo "Still no .env file found. Please make sure the .env file exists."
|
||||
exit 1
|
||||
fi
|
||||
echo "No .env file found. Creating a new one from scratch."
|
||||
touch "$ENV_FILE"
|
||||
initialize_env_file
|
||||
else
|
||||
echo "Found existing .env file. Will update values."
|
||||
# Create a backup of the existing file
|
||||
backup_env_file
|
||||
fi
|
||||
|
||||
# Function to create a timestamped backup of the .env file
|
||||
backup_env_file() {
|
||||
if [ -f "$ENV_FILE" ]; then
|
||||
local timestamp=$(date +"%Y%m%d_%H%M%S")
|
||||
local backup_file="$ENV_FILE.backup_$timestamp"
|
||||
|
||||
@ -50,10 +48,132 @@ backup_env_file() {
|
||||
echo "Failed to create backup file. Proceeding with caution..."
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Create a backup of the current .env file before making any changes
|
||||
backup_env_file
|
||||
# Function to initialize the .env file with default values
|
||||
initialize_env_file() {
|
||||
echo "Initializing new .env file with default values..."
|
||||
|
||||
# Create the new .env file with header
|
||||
cat > "$ENV_FILE" << EOL
|
||||
# Never share this file publicly. It contains sensitive information.
|
||||
# This file is used to configure various applications and services.
|
||||
# Generated by Changemaker Config Wizard on $(date)
|
||||
|
||||
# Domain Configuration
|
||||
DOMAIN=changeme.org
|
||||
BASE_DOMAIN=https://changeme.org
|
||||
|
||||
# Listmonk Configuration
|
||||
LISTMONK_ADMIN_USER=admin
|
||||
LISTMONK_ADMIN_PASSWORD=strongpassword
|
||||
LISTMONK_PORT=9000
|
||||
LISTMONK_HOSTNAME=listmonk.changeme.org
|
||||
|
||||
# Database Credentials
|
||||
POSTGRES_USER=listmonk
|
||||
POSTGRES_PASSWORD=$(generate_password 20)
|
||||
POSTGRES_DB=listmonk
|
||||
|
||||
# Monica CRM Configuration
|
||||
MONICA_APP_KEY=base64:$(openssl rand -base64 32)
|
||||
MONICA_DB_USERNAME=monica
|
||||
MONICA_DB_PASSWORD=$(generate_password 20)
|
||||
MONICA_MYSQL_DATABASE=monica
|
||||
MONICA_MYSQL_USER=monica
|
||||
MONICA_MYSQL_PASSWORD=$(generate_password 20)
|
||||
|
||||
# MkDocs Configuration
|
||||
USER_ID=1000
|
||||
GROUP_ID=1000
|
||||
MKDOCS_PORT=4000
|
||||
|
||||
# Flatnotes Configuration
|
||||
FLATNOTES_PUID=1000
|
||||
FLATNOTES_PGID=1000
|
||||
FLATNOTES_AUTH_TYPE=password
|
||||
FLATNOTES_USERNAME=user
|
||||
FLATNOTES_PASSWORD=changeMe!
|
||||
FLATNOTES_SECRET_KEY=$(generate_password 32)
|
||||
FLATNOTES_PORT=8089
|
||||
|
||||
# Gitea Configuration
|
||||
GITEA_DB_TYPE=mysql
|
||||
GITEA_DB_HOST=gitea-db:3306
|
||||
GITEA_DB_NAME=gitea
|
||||
GITEA_DB_USER=gitea
|
||||
GITEA_DB_PASSWD=$(generate_password 24)
|
||||
GITEA_DB_ROOT_PASSWORD=$(generate_password 24)
|
||||
GITEA_WEB_PORT=3030
|
||||
GITEA_SSH_PORT=2225
|
||||
GITEA_ROOT_URL=https://gitea.changeme.org
|
||||
GITEA_DOMAIN=gitea.changeme.org
|
||||
|
||||
# Apache Answer Configuration
|
||||
ANSWER_APP_PORT=9080
|
||||
|
||||
# Excalidraw Configuration
|
||||
EXCALIDRAW_PORT=3333
|
||||
EXCALIDRAW_LIBRARY_URL=https://libraries.excalidraw.com
|
||||
EXCALIDRAW_LIBRARY_BACKEND=https://us-central1-excalidraw-room-persistence.cloudfunctions.net/libraries
|
||||
EXCALIDRAW_PUBLIC_URL=https://excalidraw.changeme.org
|
||||
EXCALIDRAW_PUBLIC_SOCKET_URL=https://excalidraw.changeme.org
|
||||
|
||||
# Code Server Configuration
|
||||
CODE_SERVER_PORT=8888
|
||||
USER_NAME=coder
|
||||
|
||||
# Cloudflare Credentials
|
||||
CF_AUTH_EMAIL=
|
||||
CF_API_TOKEN=
|
||||
CF_ZONE_ID=
|
||||
CF_TUNNEL_ID=
|
||||
CF_DOMAIN=changeme.org
|
||||
|
||||
# NocoDB Configuration
|
||||
NOCODB_PORT=8090
|
||||
NOCODB_JWT_SECRET=$(generate_password 32)
|
||||
NOCODB_DB_NAME=nocodb
|
||||
NOCODB_DB_USER=noco
|
||||
NOCODB_DB_PASSWORD=$(generate_password 20)
|
||||
|
||||
# OpenWebUI Configuration
|
||||
OPEN_WEBUI_PORT=3005
|
||||
OPEN_WEBUI_URL=https://open-webui.changeme.org
|
||||
|
||||
# N8N Configuration
|
||||
N8N_PORT=5678
|
||||
N8N_HOST=n8n.changeme.org
|
||||
N8N_ENCRYPTION_KEY=$(generate_password 32)
|
||||
N8N_USER_EMAIL=admin@example.com
|
||||
N8N_USER_PASSWORD=changeMe
|
||||
GENERIC_TIMEZONE=UTC
|
||||
|
||||
# ConvertX Configuration
|
||||
CONVERTX_PORT=3100
|
||||
CONVERTX_JWT_SECRET=$(generate_password 48)
|
||||
|
||||
# Rocket.Chat Configuration
|
||||
ROCKETCHAT_IMAGE=registry.rocket.chat/rocketchat/rocket.chat
|
||||
ROCKETCHAT_RELEASE=latest
|
||||
ROCKETCHAT_PORT=3004
|
||||
ROCKETCHAT_CONTAINER_PORT=3000
|
||||
ROCKETCHAT_ROOT_URL=https://rocket.changeme.org
|
||||
ROCKETCHAT_DEPLOYMENT_ENVIRONMENT=changemaker
|
||||
ROCKETCHAT_MONGODB_VERSION=6.0
|
||||
ROCKETCHAT_MONGODB_HOST=mongodb-rocketchat
|
||||
ROCKETCHAT_MONGODB_PORT=27017
|
||||
ROCKETCHAT_MONGODB_DATABASE=rocketchat
|
||||
ROCKETCHAT_MONGODB_REPLICA_SET=rs0
|
||||
ROCKETCHAT_MONGODB_ENABLE_JOURNAL=true
|
||||
ROCKETCHAT_MONGODB_ALLOW_EMPTY_PASSWORD=yes
|
||||
|
||||
# Additional Configuration
|
||||
EOL
|
||||
|
||||
echo "New .env file created with default values."
|
||||
}
|
||||
|
||||
# Function to generate a random secure password
|
||||
generate_password() {
|
||||
@ -75,7 +195,6 @@ update_env_var() {
|
||||
local escaped_value=$(echo "$value" | sed 's/[\/&]/\\&/g')
|
||||
|
||||
# Make a temporary backup of the .env file before modification
|
||||
# Adding "_tmp" to distinguish from the main backup
|
||||
cp "$ENV_FILE" "$ENV_FILE.bak_tmp"
|
||||
|
||||
if grep -q "^$key=" "$ENV_FILE"; then
|
||||
@ -116,6 +235,9 @@ update_env_var() {
|
||||
rm -f "$ENV_FILE.bak_tmp"
|
||||
}
|
||||
|
||||
# Make sure the initialize_env_file function is available
|
||||
initialize_env_file
|
||||
|
||||
echo -e "\n\nWelcome to Changemaker Config!\n"
|
||||
echo "This script will help you configure your Changemaker instance."
|
||||
echo "Please provide the following information:"
|
||||
|
Loading…
x
Reference in New Issue
Block a user