|
|
|
@ -34,6 +34,7 @@ CONFIG_REDIS_PASSWORD=""
|
|
|
|
|
CONFIG_MINIO_ACCESS_KEY="" |
|
|
|
|
CONFIG_MINIO_ACCESS_SECRET="" |
|
|
|
|
CONFIG_DOCKER_COMMAND="" |
|
|
|
|
CONFIG_POSTGRES_SQLITE="" |
|
|
|
|
|
|
|
|
|
declare -a message_arr |
|
|
|
|
|
|
|
|
@ -78,11 +79,11 @@ urlencode() {
|
|
|
|
|
local encoded="" |
|
|
|
|
local pos c o |
|
|
|
|
|
|
|
|
|
for (( pos=0 ; pos<strlen ; pos++ )); do |
|
|
|
|
for ((pos = 0; pos < strlen; pos++)); do |
|
|
|
|
c=${string:$pos:1} |
|
|
|
|
case "$c" in |
|
|
|
|
[-_.~a-zA-Z0-9] ) o="$c" ;; |
|
|
|
|
* ) printf -v o '%%%02X' "'$c" |
|
|
|
|
[-_.~a-zA-Z0-9]) o="$c" ;; |
|
|
|
|
*) printf -v o '%%%02X' "'$c" ;; |
|
|
|
|
esac |
|
|
|
|
encoded+="$o" |
|
|
|
|
done |
|
|
|
@ -137,14 +138,14 @@ get_public_ip() {
|
|
|
|
|
|
|
|
|
|
get_nproc() { |
|
|
|
|
# Try to get the number of processors using nproc |
|
|
|
|
if command -v nproc &> /dev/null; then |
|
|
|
|
if command -v nproc &>/dev/null; then |
|
|
|
|
nproc |
|
|
|
|
else |
|
|
|
|
# Fallback: Check if /proc/cpuinfo exists and count the number of processors |
|
|
|
|
if [[ -f /proc/cpuinfo ]]; then |
|
|
|
|
grep -c ^processor /proc/cpuinfo |
|
|
|
|
# Fallback for macOS or BSD systems using sysctl |
|
|
|
|
elif command -v sysctl &> /dev/null; then |
|
|
|
|
elif command -v sysctl &>/dev/null; then |
|
|
|
|
sysctl -n hw.ncpu |
|
|
|
|
# Default to 1 processor if everything else fails |
|
|
|
|
else |
|
|
|
@ -153,7 +154,6 @@ get_nproc() {
|
|
|
|
|
fi |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
prompt() { |
|
|
|
|
local prompt_text="$1" |
|
|
|
|
local default_value="$2" |
|
|
|
@ -172,6 +172,41 @@ prompt() {
|
|
|
|
|
fi |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
prompt_oneof() { |
|
|
|
|
local response |
|
|
|
|
local resp_upper |
|
|
|
|
local oneof_text |
|
|
|
|
local prompt_text="$1" |
|
|
|
|
local default_response="$2" |
|
|
|
|
shift 1 |
|
|
|
|
|
|
|
|
|
prompt_text+=" (default: $default_response) " |
|
|
|
|
oneof_text+="[" |
|
|
|
|
for one in "$@"; do |
|
|
|
|
oneof_text+="$one," |
|
|
|
|
done |
|
|
|
|
oneof_text="${oneof_text%%,}]" |
|
|
|
|
prompt_text+="${oneof_text}: " |
|
|
|
|
|
|
|
|
|
while true; do |
|
|
|
|
read -r -p "$prompt_text" response |
|
|
|
|
if [ -z "$response" ]; then |
|
|
|
|
echo "$default_response" |
|
|
|
|
return |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
for one in "$@"; do |
|
|
|
|
resp_upper="$(echo "$response" | tr '[:lower:]' '[:upper:]')" |
|
|
|
|
one_upper="$(echo "$one" | tr '[:lower:]' '[:upper:]')" |
|
|
|
|
if [ "$resp_upper" = "$one_upper" ]; then |
|
|
|
|
echo "$one" |
|
|
|
|
return |
|
|
|
|
fi |
|
|
|
|
done |
|
|
|
|
print_error "This field should be one of ${oneof_text}." |
|
|
|
|
done |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
prompt_required() { |
|
|
|
|
local prompt_text="$1" |
|
|
|
|
local response |
|
|
|
@ -205,25 +240,21 @@ prompt_number() {
|
|
|
|
|
confirm() { |
|
|
|
|
local prompt_text="$1" |
|
|
|
|
local default_response="${2:-N}" |
|
|
|
|
local secondary_response |
|
|
|
|
local response |
|
|
|
|
case "$default_response" in |
|
|
|
|
"Y") secondary_response="N" ;; |
|
|
|
|
"N") secondary_response="Y" ;; |
|
|
|
|
esac |
|
|
|
|
|
|
|
|
|
if [ "$default_response" = "Y" ] || [ "$default_response" = "y" ]; then |
|
|
|
|
prompt_text+=" [Y/n]: " |
|
|
|
|
else |
|
|
|
|
prompt_text+=" [y/N]: " |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
read -r -p "$prompt_text" response |
|
|
|
|
response="${response:-$default_response}" |
|
|
|
|
|
|
|
|
|
if [ "$response" = "Y" ] || [ "$response" = "y" ]; then |
|
|
|
|
response="$(prompt_oneof "$prompt_text" "$default_response" "$secondary_response")" |
|
|
|
|
if [ "$response" = "Y" ]; then |
|
|
|
|
return 0 |
|
|
|
|
else |
|
|
|
|
elif [ "$response" = "N" ]; then |
|
|
|
|
return 1 |
|
|
|
|
fi |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
generate_contact_email() { |
|
|
|
|
local domain="$1" |
|
|
|
|
local email |
|
|
|
@ -266,14 +297,13 @@ add_to_hosts() {
|
|
|
|
|
local HOSTS_FILE="/etc/hosts" |
|
|
|
|
local TEMP_HOSTS_FILE="/tmp/hosts.tmp" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if is_valid_domain $CONFIG_MINIO_DOMAIN_NAME; then |
|
|
|
|
return 0 |
|
|
|
|
elif sudo grep -q "${CONFIG_MINIO_DOMAIN_NAME}" "$HOSTS_FILE"; then |
|
|
|
|
return 0 |
|
|
|
|
else |
|
|
|
|
sudo cp "$HOSTS_FILE" "$TEMP_HOSTS_FILE" |
|
|
|
|
echo "$IP ${CONFIG_MINIO_DOMAIN_NAME}" | sudo tee -a "$TEMP_HOSTS_FILE" > /dev/null |
|
|
|
|
echo "$IP ${CONFIG_MINIO_DOMAIN_NAME}" | sudo tee -a "$TEMP_HOSTS_FILE" >/dev/null |
|
|
|
|
if sudo mv "$TEMP_HOSTS_FILE" "$HOSTS_FILE"; then |
|
|
|
|
print_info "Added ${CONFIG_MINIO_DOMAIN_NAME} to $HOSTS_FILE" |
|
|
|
|
print_note "You may need to reboot your system, If the uploaded attachments are not accessible." |
|
|
|
@ -350,6 +380,25 @@ check_if_docker_is_running() {
|
|
|
|
|
fi |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
persistent_store_isdeleted() { |
|
|
|
|
_persistent_store="$1" |
|
|
|
|
|
|
|
|
|
if [ ! -d "$_persistent_store" ]; then |
|
|
|
|
print_warning "Persistent store was deleted without stopping the containers" |
|
|
|
|
|
|
|
|
|
for container in $($CONFIG_DOCKER_COMMAND ps | grep -Eo 'nocodb-[a-z]+-[0-9]+$'); do |
|
|
|
|
if ! $CONFIG_DOCKER_COMMAND stop "$container" > /dev/null 2>&1; then |
|
|
|
|
print_error "Failed to stop ${container}" |
|
|
|
|
exit 1 |
|
|
|
|
fi |
|
|
|
|
done |
|
|
|
|
|
|
|
|
|
return 0 |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
return 1 |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
# Main functions |
|
|
|
|
check_existing_installation() { |
|
|
|
|
NOCO_FOUND=false |
|
|
|
@ -358,18 +407,17 @@ check_existing_installation() {
|
|
|
|
|
if [ -d "$NOCO_HOME" ]; then |
|
|
|
|
NOCO_FOUND=true |
|
|
|
|
elif $CONFIG_DOCKER_COMMAND ps --format '{{.Names}}' | grep -q "nocodb"; then |
|
|
|
|
NOCO_ID=$($CONFIG_DOCKER_COMMAND ps | grep "nocodb/nocodb" | cut -d ' ' -f 1) |
|
|
|
|
CUSTOM_HOME=$($CONFIG_DOCKER_COMMAND inspect --format='{{index .Mounts 0}}' "$NOCO_ID" | cut -d ' ' -f 3) |
|
|
|
|
PARENT_DIR=$(dirname "$CUSTOM_HOME") |
|
|
|
|
NOCO_ID="$($CONFIG_DOCKER_COMMAND ps | grep "nocodb/nocodb" | cut -d ' ' -f 1)" |
|
|
|
|
CUSTOM_HOME="$($CONFIG_DOCKER_COMMAND inspect --format='{{index .Mounts 0}}' "$NOCO_ID" | cut -d ' ' -f 3)" |
|
|
|
|
PARENT_DIR="$(dirname "$CUSTOM_HOME")" |
|
|
|
|
|
|
|
|
|
if ! persistent_store_isdeleted "$PARENT_DIR"; then |
|
|
|
|
ln -s "$PARENT_DIR" "$NOCO_HOME" |
|
|
|
|
basename "$PARENT_DIR" > "$NOCO_HOME/.COMPOSE_PROJECT_NAME" |
|
|
|
|
|
|
|
|
|
basename "$PARENT_DIR" >"$NOCO_HOME/.COMPOSE_PROJECT_NAME" |
|
|
|
|
NOCO_FOUND=true |
|
|
|
|
else |
|
|
|
|
mkdir -p "$NOCO_HOME" |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
fi |
|
|
|
|
mkdir -p "$NOCO_HOME" |
|
|
|
|
cd "$NOCO_HOME" || exit 1 |
|
|
|
|
|
|
|
|
|
# Check if nocodb is already installed |
|
|
|
@ -388,7 +436,7 @@ check_existing_installation() {
|
|
|
|
|
exit 0 |
|
|
|
|
else |
|
|
|
|
echo "Reinstalling NocoDB..." |
|
|
|
|
$CONFIG_DOCKER_COMMAND compose down |
|
|
|
|
$CONFIG_DOCKER_COMMAND compose down -v |
|
|
|
|
|
|
|
|
|
unset COMPOSE_PROJECT_NAME |
|
|
|
|
cd /tmp || exit 1 |
|
|
|
@ -430,11 +478,7 @@ get_user_inputs() {
|
|
|
|
|
CONFIG_DOMAIN_NAME=$(prompt "Enter the IP address or domain name for the NocoDB instance" "$(get_public_ip)") |
|
|
|
|
|
|
|
|
|
if is_valid_domain "$CONFIG_DOMAIN_NAME"; then |
|
|
|
|
if confirm "Do you want to configure SSL for $CONFIG_DOMAIN_NAME?"; then |
|
|
|
|
CONFIG_SSL_ENABLED="Y" |
|
|
|
|
else |
|
|
|
|
CONFIG_SSL_ENABLED="N" |
|
|
|
|
fi |
|
|
|
|
CONFIG_SSL_ENABLED="$(prompt_oneof "Do you want to configure SSL for $CONFIG_DOMAIN_NAME" "Y" "N")" |
|
|
|
|
else |
|
|
|
|
CONFIG_SSL_ENABLED="N" |
|
|
|
|
fi |
|
|
|
@ -447,31 +491,29 @@ get_user_inputs() {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
get_advanced_options() { |
|
|
|
|
CONFIG_EDITION=$(prompt "Choose Community or Enterprise Edition [CE/EE]" "CE") |
|
|
|
|
CONFIG_EDITION=$(prompt_oneof "Choose Community or Enterprise Edition" "CE" "EE") |
|
|
|
|
|
|
|
|
|
if [ "$CONFIG_EDITION" = "EE" ] || [ "$CONFIG_EDITION" = "ee" ]; then |
|
|
|
|
if [ "$CONFIG_EDITION" = "EE" ]; then |
|
|
|
|
CONFIG_LICENSE_KEY=$(prompt_required "Enter the NocoDB license key") |
|
|
|
|
else |
|
|
|
|
CONFIG_POSTGRES_SQLITE=$(prompt_oneof "Select PostgreSQL or SQLite as your database" "P" "S") |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
CONFIG_REDIS_ENABLED=$(confirm "Do you want to enable Redis for caching?" "Y" && echo "Y" || echo "N" "Y") |
|
|
|
|
CONFIG_MINIO_ENABLED=$(confirm "Do you want to enable Minio for file storage?" "Y" && echo "Y" || echo "N" "Y") |
|
|
|
|
CONFIG_REDIS_ENABLED=$(prompt_oneof "Do you want to enable Redis for caching?" "Y" "N") |
|
|
|
|
CONFIG_MINIO_ENABLED=$(prompt_oneof "Do you want to enable Minio for file storage?" "Y" "N") |
|
|
|
|
|
|
|
|
|
if [ "$CONFIG_MINIO_ENABLED" = "Y" ] || [ "$CONFIG_MINIO_ENABLED" = "y" ]; then |
|
|
|
|
if [ "$CONFIG_MINIO_ENABLED" = "Y" ]; then |
|
|
|
|
|
|
|
|
|
CONFIG_MINIO_DOMAIN_NAME=$(prompt "Enter the MinIO domain name" "$(get_public_ip)") |
|
|
|
|
|
|
|
|
|
if is_valid_domain "$CONFIG_MINIO_DOMAIN_NAME"; then |
|
|
|
|
if confirm "Do you want to configure SSL for $CONFIG_MINIO_DOMAIN_NAME?"; then |
|
|
|
|
CONFIG_MINIO_SSL_ENABLED="Y" |
|
|
|
|
else |
|
|
|
|
CONFIG_MINIO_SSL_ENABLED="N" |
|
|
|
|
fi |
|
|
|
|
CONFIG_MINIO_SSL_ENABLED="$(prompt_oneof "Do you want to configure SSL for $CONFIG_MINIO_DOMAIN_NAME" "Y" "N")" |
|
|
|
|
else |
|
|
|
|
CONFIG_MINIO_SSL_ENABLED="N" |
|
|
|
|
fi |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
CONFIG_WATCHTOWER_ENABLED=$(confirm "Do you want to enable Watchtower for automatic updates?" "Y" && echo "Y" || echo "N") |
|
|
|
|
CONFIG_WATCHTOWER_ENABLED=$(prompt_oneof "Do you want to enable Watchtower for automatic updates?" "Y" "N") |
|
|
|
|
|
|
|
|
|
NUM_CORES=$(get_nproc) |
|
|
|
|
CONFIG_NUM_INSTANCES=$(read_number_range "How many instances of NocoDB do you want to run?" 1 "$NUM_CORES" 1) |
|
|
|
@ -479,6 +521,7 @@ get_advanced_options() {
|
|
|
|
|
|
|
|
|
|
set_default_options() { |
|
|
|
|
CONFIG_EDITION="CE" |
|
|
|
|
CONFIG_POSTGRES_SQLITE="P" |
|
|
|
|
CONFIG_REDIS_ENABLED="Y" |
|
|
|
|
CONFIG_MINIO_ENABLED="Y" |
|
|
|
|
CONFIG_MINIO_DOMAIN_NAME=$(get_public_ip) |
|
|
|
@ -496,13 +539,12 @@ generate_credentials() {
|
|
|
|
|
|
|
|
|
|
create_docker_compose_file() { |
|
|
|
|
|
|
|
|
|
if [ "${CONFIG_EDITION}" = "EE" ] || [ "${CONFIG_EDITION}" = "ee" ]; then |
|
|
|
|
if [ "${CONFIG_EDITION}" = "EE" ]; then |
|
|
|
|
image="nocodb/nocodb-ee:latest" |
|
|
|
|
else |
|
|
|
|
image="nocodb/nocodb:latest" |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# for easier string interpolation |
|
|
|
|
if [ "${CONFIG_REDIS_ENABLED}" = "Y" ]; then |
|
|
|
|
gen_redis=1 |
|
|
|
@ -510,10 +552,13 @@ create_docker_compose_file() {
|
|
|
|
|
if [ "${CONFIG_MINIO_ENABLED}" = "Y" ]; then |
|
|
|
|
gen_minio=1 |
|
|
|
|
fi |
|
|
|
|
if [ "${CONFIG_POSTGRES_SQLITE}" = "P" ]; then |
|
|
|
|
gen_postgres=1 |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
local compose_file="docker-compose.yml" |
|
|
|
|
|
|
|
|
|
cat > "$compose_file" <<EOF |
|
|
|
|
cat >"$compose_file" <<EOF |
|
|
|
|
services: |
|
|
|
|
nocodb: |
|
|
|
|
image: ${image} |
|
|
|
@ -521,10 +566,18 @@ services:
|
|
|
|
|
deploy: |
|
|
|
|
mode: replicated |
|
|
|
|
replicas: ${CONFIG_NUM_INSTANCES} |
|
|
|
|
EOF |
|
|
|
|
|
|
|
|
|
if [ -n "$gen_postgres" ] || [ -n "$gen_redis" ] || [ "$gen_redis" ]; then |
|
|
|
|
cat >>"$compose_file" <<EOF |
|
|
|
|
depends_on: |
|
|
|
|
- db |
|
|
|
|
${gen_postgres:+- db} |
|
|
|
|
${gen_redis:+- redis} |
|
|
|
|
${gen_minio:+- minio} |
|
|
|
|
EOF |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
cat >>"$compose_file" <<EOF |
|
|
|
|
restart: unless-stopped |
|
|
|
|
volumes: |
|
|
|
|
- ./nocodb:/usr/app/data |
|
|
|
@ -533,25 +586,28 @@ services:
|
|
|
|
|
- "traefik.enable=true" |
|
|
|
|
- "traefik.http.routers.nocodb.rule=Host(\`${CONFIG_DOMAIN_NAME}\`)" |
|
|
|
|
EOF |
|
|
|
|
# IF SSL is Enabled add the following lines |
|
|
|
|
# IF SSL is Enabled add the following lines |
|
|
|
|
if [ "$CONFIG_SSL_ENABLED" = "Y" ]; then |
|
|
|
|
cat >> "$compose_file" <<EOF |
|
|
|
|
cat >>"$compose_file" <<EOF |
|
|
|
|
|
|
|
|
|
- "traefik.http.routers.nocodb.entrypoints=websecure" |
|
|
|
|
- "traefik.http.routers.nocodb.tls=true" |
|
|
|
|
- "traefik.http.routers.nocodb.tls.certresolver=letsencrypt" |
|
|
|
|
EOF |
|
|
|
|
# If no ssl just configure the web entrypoint |
|
|
|
|
# If no ssl just configure the web entrypoint |
|
|
|
|
else |
|
|
|
|
cat >> "$compose_file" <<EOF |
|
|
|
|
cat >>"$compose_file" <<EOF |
|
|
|
|
- "traefik.http.routers.nocodb.entrypoints=web" |
|
|
|
|
EOF |
|
|
|
|
fi |
|
|
|
|
# Continue with the compose file |
|
|
|
|
cat >> "$compose_file" <<EOF |
|
|
|
|
cat >>"$compose_file" <<EOF |
|
|
|
|
networks: |
|
|
|
|
- nocodb-network |
|
|
|
|
EOF |
|
|
|
|
|
|
|
|
|
if [ "$CONFIG_POSTGRES_SQLITE" = "P" ]; then |
|
|
|
|
cat >>"$compose_file" <<EOF |
|
|
|
|
db: |
|
|
|
|
image: postgres:16.1 |
|
|
|
|
env_file: docker.env |
|
|
|
@ -565,7 +621,10 @@ EOF
|
|
|
|
|
retries: 5 |
|
|
|
|
networks: |
|
|
|
|
- nocodb-network |
|
|
|
|
EOF |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
cat >>"$compose_file" <<EOF |
|
|
|
|
traefik: |
|
|
|
|
image: traefik:v3.1 |
|
|
|
|
command: |
|
|
|
@ -574,16 +633,16 @@ EOF
|
|
|
|
|
- "--entrypoints.web.address=:80" |
|
|
|
|
- "--providers.docker.exposedByDefault=false" |
|
|
|
|
EOF |
|
|
|
|
# In Traefik we need to add the minio entrypoint if it is enabled |
|
|
|
|
# In Traefik we need to add the minio entrypoint if it is enabled |
|
|
|
|
if [ "$CONFIG_MINIO_ENABLED" = "Y" ]; then |
|
|
|
|
cat >> "$compose_file" <<EOF |
|
|
|
|
cat >>"$compose_file" <<EOF |
|
|
|
|
- "--entrypoints.minio.address=:9000" |
|
|
|
|
EOF |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
# If SSL is enabled we need to add the following lines to the traefik service |
|
|
|
|
# If SSL is enabled we need to add the following lines to the traefik service |
|
|
|
|
if [ "$CONFIG_SSL_ENABLED" = "Y" ] || [ "$CONFIG_MINIO_SSL_ENABLED" = "Y" ]; then |
|
|
|
|
cat >> "$compose_file" <<EOF |
|
|
|
|
cat >>"$compose_file" <<EOF |
|
|
|
|
- "--entrypoints.websecure.address=:443" |
|
|
|
|
- "--certificatesresolvers.letsencrypt.acme.httpchallenge=true" |
|
|
|
|
- "--certificatesresolvers.letsencrypt.acme.httpchallenge.entrypoint=web" |
|
|
|
@ -592,7 +651,7 @@ EOF
|
|
|
|
|
EOF |
|
|
|
|
fi |
|
|
|
|
# Continue with the compose file |
|
|
|
|
cat >> "$compose_file" <<EOF |
|
|
|
|
cat >>"$compose_file" <<EOF |
|
|
|
|
ports: |
|
|
|
|
- "80:80" |
|
|
|
|
- "443:443" |
|
|
|
@ -608,9 +667,9 @@ EOF
|
|
|
|
|
|
|
|
|
|
EOF |
|
|
|
|
|
|
|
|
|
# If Redis is enabled add the following lines to the compose file |
|
|
|
|
# If Redis is enabled add the following lines to the compose file |
|
|
|
|
if [ "${CONFIG_REDIS_ENABLED}" = "Y" ]; then |
|
|
|
|
cat >> "$compose_file" <<EOF |
|
|
|
|
cat >>"$compose_file" <<EOF |
|
|
|
|
redis: |
|
|
|
|
image: redis:latest |
|
|
|
|
restart: unless-stopped |
|
|
|
@ -628,9 +687,9 @@ EOF
|
|
|
|
|
EOF |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
# IF Minio is enabled add the following lines to the compose file |
|
|
|
|
# IF Minio is enabled add the following lines to the compose file |
|
|
|
|
if [ "${CONFIG_MINIO_ENABLED}" = "Y" ]; then |
|
|
|
|
cat >> "$compose_file" <<EOF |
|
|
|
|
cat >>"$compose_file" <<EOF |
|
|
|
|
minio: |
|
|
|
|
image: minio/minio:latest |
|
|
|
|
restart: unless-stopped |
|
|
|
@ -644,33 +703,33 @@ EOF
|
|
|
|
|
- "traefik.http.services.minio.loadbalancer.server.port=9000" |
|
|
|
|
- "traefik.http.routers.minio.rule=Host(\`${CONFIG_MINIO_DOMAIN_NAME}\`)" |
|
|
|
|
EOF |
|
|
|
|
# If minio SSL is enabled, set the entry point to websecure |
|
|
|
|
# If minio SSL is enabled, set the entry point to websecure |
|
|
|
|
if [ "$CONFIG_MINIO_SSL_ENABLED" = "Y" ]; then |
|
|
|
|
cat >> "$compose_file" <<EOF |
|
|
|
|
cat >>"$compose_file" <<EOF |
|
|
|
|
- "traefik.http.routers.minio.entrypoints=websecure" |
|
|
|
|
- "traefik.http.routers.minio.tls=true" |
|
|
|
|
- "traefik.http.routers.minio.tls.certresolver=letsencrypt" |
|
|
|
|
EOF |
|
|
|
|
# If minio is enabled and the domain is valid, set the entry point to web |
|
|
|
|
# If minio is enabled and the domain is valid, set the entry point to web |
|
|
|
|
elif is_valid_domain "$CONFIG_MINIO_DOMAIN_NAME"; then |
|
|
|
|
cat >> "$compose_file" <<EOF |
|
|
|
|
cat >>"$compose_file" <<EOF |
|
|
|
|
- "traefik.http.routers.minio.entrypoints=web" |
|
|
|
|
EOF |
|
|
|
|
|
|
|
|
|
# If minio is enabled, valid domain name is not configured, set the entry point to Port 9000 |
|
|
|
|
# If minio is enabled, valid domain name is not configured, set the entry point to Port 9000 |
|
|
|
|
else |
|
|
|
|
cat >> "$compose_file" <<EOF |
|
|
|
|
cat >>"$compose_file" <<EOF |
|
|
|
|
- "traefik.http.routers.minio.entrypoints=minio" |
|
|
|
|
EOF |
|
|
|
|
fi |
|
|
|
|
cat >> "$compose_file" <<EOF |
|
|
|
|
cat >>"$compose_file" <<EOF |
|
|
|
|
networks: |
|
|
|
|
- nocodb-network |
|
|
|
|
|
|
|
|
|
EOF |
|
|
|
|
fi |
|
|
|
|
fi |
|
|
|
|
if [ "${CONFIG_WATCHTOWER_ENABLED}" = "Y" ]; then |
|
|
|
|
cat >> "$compose_file" <<EOF |
|
|
|
|
cat >>"$compose_file" <<EOF |
|
|
|
|
watchtower: |
|
|
|
|
image: containrrr/watchtower |
|
|
|
|
volumes: |
|
|
|
@ -684,13 +743,13 @@ EOF
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
if [ "$CONFIG_REDIS_ENABLED" = "Y" ]; then |
|
|
|
|
cat >> "$compose_file" <<EOF |
|
|
|
|
cat >>"$compose_file" <<EOF |
|
|
|
|
volumes: |
|
|
|
|
redis: |
|
|
|
|
EOF |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
cat >> "$compose_file" <<EOF |
|
|
|
|
cat >>"$compose_file" <<EOF |
|
|
|
|
networks: |
|
|
|
|
nocodb-network: |
|
|
|
|
driver: bridge |
|
|
|
@ -702,28 +761,28 @@ create_env_file() {
|
|
|
|
|
local encoded_password |
|
|
|
|
encoded_password=$(urlencode "${CONFIG_POSTGRES_PASSWORD}") |
|
|
|
|
ENCODED_REDIS_PASSWORD=$(urlencode "$CONFIG_REDIS_PASSWORD") |
|
|
|
|
cat > "$env_file" <<EOF |
|
|
|
|
cat >"$env_file" <<EOF |
|
|
|
|
POSTGRES_DB=nocodb |
|
|
|
|
POSTGRES_USER=postgres |
|
|
|
|
POSTGRES_PASSWORD=${CONFIG_POSTGRES_PASSWORD} |
|
|
|
|
EOF |
|
|
|
|
|
|
|
|
|
if [ "${CONFIG_EDITION}" = "EE" ] || [ "${CONFIG_EDITION}" = "ee" ]; then |
|
|
|
|
echo "DATABASE_URL=postgres://postgres:${encoded_password}@db:5432/nocodb" >> "$env_file" |
|
|
|
|
echo "NC_LICENSE_KEY=${CONFIG_LICENSE_KEY}" >> "$env_file" |
|
|
|
|
else |
|
|
|
|
echo "NC_DB=pg://db:5432?d=nocodb&user=postgres&password=${encoded_password}" >> "$env_file" |
|
|
|
|
if [ "${CONFIG_EDITION}" = "EE" ]; then |
|
|
|
|
echo "DATABASE_URL=postgres://postgres:${encoded_password}@db:5432/nocodb" >>"$env_file" |
|
|
|
|
echo "NC_LICENSE_KEY=${CONFIG_LICENSE_KEY}" >>"$env_file" |
|
|
|
|
elif [ "${CONFIG_POSTGRES_SQLITE}" = "P" ]; then |
|
|
|
|
echo "NC_DB=pg://db:5432?d=nocodb&user=postgres&password=${encoded_password}" >>"$env_file" |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
if [ "${CONFIG_REDIS_ENABLED}" = "Y" ]; then |
|
|
|
|
cat >> "$env_file" <<EOF |
|
|
|
|
cat >>"$env_file" <<EOF |
|
|
|
|
REDIS_PASSWORD=${CONFIG_REDIS_PASSWORD} |
|
|
|
|
NC_REDIS_URL=redis://:${ENCODED_REDIS_PASSWORD}@redis:6379/0 |
|
|
|
|
EOF |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
if [ "${CONFIG_MINIO_ENABLED}" = "Y" ]; then |
|
|
|
|
cat >> "$env_file" <<EOF |
|
|
|
|
cat >>"$env_file" <<EOF |
|
|
|
|
MINIO_ROOT_USER=${CONFIG_MINIO_ACCESS_KEY} |
|
|
|
|
MINIO_ROOT_PASSWORD=${CONFIG_MINIO_ACCESS_SECRET} |
|
|
|
|
NC_S3_BUCKET_NAME=nocodb |
|
|
|
@ -733,17 +792,17 @@ NC_S3_ACCESS_SECRET=${CONFIG_MINIO_ACCESS_SECRET}
|
|
|
|
|
NC_S3_FORCE_PATH_STYLE=true |
|
|
|
|
EOF |
|
|
|
|
if [ "$CONFIG_MINIO_SSL_ENABLED" = "Y" ]; then |
|
|
|
|
echo "NC_S3_ENDPOINT=https://${CONFIG_MINIO_DOMAIN_NAME}" >> "$env_file" |
|
|
|
|
echo "NC_S3_ENDPOINT=https://${CONFIG_MINIO_DOMAIN_NAME}" >>"$env_file" |
|
|
|
|
elif is_valid_domain "$CONFIG_MINIO_DOMAIN_NAME"; then |
|
|
|
|
echo "NC_S3_ENDPOINT=http://${CONFIG_MINIO_DOMAIN_NAME}" >> "$env_file" |
|
|
|
|
echo "NC_S3_ENDPOINT=http://${CONFIG_MINIO_DOMAIN_NAME}" >>"$env_file" |
|
|
|
|
else |
|
|
|
|
echo "NC_S3_ENDPOINT=http://${CONFIG_MINIO_DOMAIN_NAME}:9000" >> "$env_file" |
|
|
|
|
echo "NC_S3_ENDPOINT=http://${CONFIG_MINIO_DOMAIN_NAME}:9000" >>"$env_file" |
|
|
|
|
fi |
|
|
|
|
fi |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
create_update_script() { |
|
|
|
|
cat > ./update.sh <<EOF |
|
|
|
|
cat >./update.sh <<EOF |
|
|
|
|
#!/bin/bash |
|
|
|
|
$CONFIG_DOCKER_COMMAND compose pull |
|
|
|
|
$CONFIG_DOCKER_COMMAND compose up -d --force-recreate |
|
|
|
@ -881,7 +940,7 @@ show_logs() {
|
|
|
|
|
echo |
|
|
|
|
|
|
|
|
|
if [[ "$log_choice" =~ ^[0-9]+$ ]] && [ "$log_choice" -gt 0 ] && [ "$log_choice" -lt "$count" ]; then |
|
|
|
|
service_index=$((log_choice-1)) |
|
|
|
|
service_index=$((log_choice - 1)) |
|
|
|
|
service="${services[$service_index]}" |
|
|
|
|
num_replicas="${service_replicas[$service_index]}" |
|
|
|
|
|
|
|
|
@ -937,7 +996,6 @@ monitoring_service() {
|
|
|
|
|
$CONFIG_DOCKER_COMMAND stats |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
main() { |
|
|
|
|
CONFIG_DOCKER_COMMAND=$([ "$(check_for_docker_sudo)" = "y" ] && echo "sudo docker" || echo "docker") |
|
|
|
|
|
|
|
|
@ -952,7 +1010,7 @@ main() {
|
|
|
|
|
start_services |
|
|
|
|
display_completion_message |
|
|
|
|
|
|
|
|
|
if confirm "Do you want to start the management menu?"; then |
|
|
|
|
if confirm "Do you want to start the management menu?" "Y"; then |
|
|
|
|
management_menu |
|
|
|
|
fi |
|
|
|
|
} |
|
|
|
|