Forráskód Böngészése

nc es01 heapsize 4g

larry1chan@qq.com 6 hónapja
szülő
commit
30a2fa6d9e
7 módosított fájl, 357 hozzáadás és 15 törlés
  1. 8 6
      .env
  2. 0 1
      alice.enc
  3. 5 4
      backup_volumes.sh
  4. 21 0
      docker-compose.yml
  5. 210 0
      docker-compose.yml-rm-ext1
  6. 107 0
      restore_db.sh
  7. 6 4
      restore_volumes.sh

+ 8 - 6
.env

@@ -1,9 +1,11 @@
 MYSQL_ROOT_PASSWORD=2eqQ6Rqs
 MYSQL_PASSWORD=123456
-CONTAINER_NAME=nc5
+CONTAINER_NAME=nc6
 NEXTCLOUD_HOST=https://1984.algometic.com
-USERROOT_LARRY=/media/orbitzs/nextcloud_files/apex/larry
-USERROOT_MICHELLE=/media/orbitzs/nextcloud_files/apex/michellechanpl
-USERROOT_JENNIFER=/media/orbitzs/nextcloud_files/apex/jennifer.pui
-USERROOT_MINDY=/media/orbitzs/nextcloud_files/apex/mindy.lui
-USERROOT_PLAYER1=/media/orbitzs/nextcloud_files/apex/player1
+USERROOT_LARRY=/media/yazoo/nextcloud_files/apex/larry
+USERROOT_MICHELLE=/media/yazoo/nextcloud_files/apex/michellechanpl
+USERROOT_JENNIFER=/media/yazoo/nextcloud_files/apex/jennifer.pui
+USERROOT_MINDY=/media/yazoo/nextcloud_files/apex/mindy.lui
+USERROOT_PLAYER1=/media/yazoo/nextcloud_files/apex/player1
+USERROOT_CRM_MEDIA_PROGRAMS=/media/yazoo/luks-67672a15-a412-4a17-bb01-c76509e21243/crm/crm-media/programs
+USERROOT_EXT2=/media/yazoo/nextcloud_files

+ 0 - 1
alice.enc

@@ -1 +0,0 @@
-U2FsdGVkX18iFRrGLcJsf4gaDKE9aLFF4wgQ13uKiEs=

+ 5 - 4
backup_volumes.sh

@@ -39,7 +39,7 @@
 #
 #           BACKUP_DIR - verify the location is accessible. The mount point is named by the login user so it may look different 
 #           VOLUMES    - are all the volumes to backup include in the list? 
-#                        <volume>_nc4_files: stores the core admin account and binaries, config of next cloud
+#                        <volume>_nc6_files: stores the core admin account and binaries, config of next cloud
 #                        <volume>_oo_data: document server
 #                        <volume>_es_index: elastic search index files 
 #                        <volume>_db: mariadb - nextcloud db 
@@ -47,12 +47,13 @@
 #
 #
 # Variables
-BACKUP_DIR="/media/yaye/nextcloud_files/backup/nc2/docker_volumes"  # Change this to your desired backup directory
+BACKUP_DIR="/media/yazoo/luks-5955839a-aa5e-40ef-bb39-2721cf531b48/backups/nextcloud"  # Change this to your desired backup directory
+#BACKUP_DIR="/media/yazoo/nextcloud_files/backup/nc2/docker_volumes"  # Change this to your desired backup directory
 TIMESTAMP=$(date +"%Y%m%d_%H%M%S")
 
 # List of volumes to backup
-VOLUMES=("nc4_files" "nc4_oo_data" "nc4_es_index" "nc4_db" "nc4_clamav")  # Replace with your volume names
-#VOLUMES=("nc4_redis" "nc4_oo_data" "nc4_es_index"  "nc4_clamav")  # Replace with your volume names
+VOLUMES=("nc6_files" "nc6_oo_data" "nc6_es_index" "nc6_db" "nc6_clamav")  # Replace with your volume names
+#VOLUMES=("nc6_redis" "nc6_oo_data" "nc6_es_index"  "nc6_clamav")  # Replace with your volume names
 
 # Ensure backup directory exists
 mkdir -p "$BACKUP_DIR"

+ 21 - 0
docker-compose.yml

@@ -1,6 +1,23 @@
 version: '3'
 
 volumes:
+  files_ext_crm-media-programs:
+    name: ${CONTAINER_NAME}_files_crm-media-programs
+    driver: local
+    driver_opts:
+      type: volume
+      o: 'bind'
+      device: ${USERROOT_CRM_MEDIA_PROGRAMS}
+
+
+  files_ext2:
+    name: ${CONTAINER_NAME}_files_ext2
+    driver: local
+    driver_opts:
+      type: volume
+      o: 'bind'
+      device: ${USERROOT_EXT2} 
+
 
   files_larry:
     name: ${CONTAINER_NAME}_files_larry
@@ -106,6 +123,8 @@ services:
       - files_jennifer:/var/www/html/data/jennifer
       - files_michelle:/var/www/html/data/michelle
       - files_larry:/var/www/html/data/larry
+      - files_ext2:/mnt/ext2
+      - files_ext_crm-media-programs:/mnt/ext_crm-media-programs
     restart: "no" 
     environment:
       - REDIS_HOST=redis
@@ -135,6 +154,8 @@ services:
     environment:
       - node.name=es01
       - discovery.type=single-node
+      - bootstrap.memory_lock=true
+      - "ES_JAVA_OPTS=-Xms1g -Xmx4g"
     ulimits:
       memlock:
         soft: -1

+ 210 - 0
docker-compose.yml-rm-ext1

@@ -0,0 +1,210 @@
+version: '3'
+
+volumes:
+
+
+  files_ext2:
+    name: ${CONTAINER_NAME}_files_ext2
+    driver: local
+    driver_opts:
+      type: volume
+      o: 'bind'
+      device: ${USERROOT_EXT2} 
+
+  files_ext1:
+    name: ${CONTAINER_NAME}_files_ext1
+    driver: local
+    driver_opts:
+      type: volume
+      o: 'bind'
+      device: ${USERROOT_EXT1} 
+
+  files_larry:
+    name: ${CONTAINER_NAME}_files_larry
+    driver: local
+    driver_opts:
+      type: volume
+      o: 'bind'
+      device: ${USERROOT_LARRY} 
+
+  files_michelle:
+    name: ${CONTAINER_NAME}_files_michelle
+    driver: local
+    driver_opts:
+      type: volume
+      o: 'bind'
+      device: ${USERROOT_MICHELLE} 
+
+  files_jennifer:
+    name: ${CONTAINER_NAME}_files_jennifer
+    driver: local
+    driver_opts:
+      type: volume
+      o: 'bind'
+      device: ${USERROOT_JENNIFER} 
+
+  files_mindy:
+    name: ${CONTAINER_NAME}_files_mindy
+    driver: local
+    driver_opts:
+      type: volume
+      o: 'bind'
+      device: ${USERROOT_MINDY} 
+
+  files_player1:
+    name: ${CONTAINER_NAME}_files_player1
+    driver: local
+    driver_opts:
+      type: volume
+      o: 'bind'
+      device: ${USERROOT_PLAYER1} 
+
+  files:
+    name: ${CONTAINER_NAME}_files
+    driver: local
+
+  db:
+    name: ${CONTAINER_NAME}_db
+    driver: local
+
+  redis:
+    name: ${CONTAINER_NAME}_redis
+    driver: local
+
+  es_index:
+    name: ${CONTAINER_NAME}_es_index
+    driver: local
+
+  oo_data:
+    name: ${CONTAINER_NAME}_oo_data
+    driver: local
+ 
+  clamav:
+    name: ${CONTAINER_NAME}_clamav
+    driver: local
+
+services:
+  db:
+    image: mariadb:11.4.2
+    container_name: ${CONTAINER_NAME}_db
+    command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
+    restart: "no" 
+    volumes:
+      - db:/var/lib/mysql
+    #  - db_r1:/var/lib/mysql
+    environment:
+      - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
+      - MYSQL_PASSWORD=${MYSQL_PASSWORD}
+      - MYSQL_DATABASE=nextcloud
+      - MYSQL_USER=nextcloud
+
+
+  redis:
+    image: redis:7.2.4-alpine
+    container_name: ${CONTAINER_NAME}_redis
+    restart: "no"
+    volumes:
+      - redis:/var/lib/redis
+
+
+  app:
+#    image: nextcloud:30.0.4-apache
+    image: nextcloud-ffmpeg-image:latest
+    container_name: ${CONTAINER_NAME}
+    ports:
+      - 1234:80
+    links:
+      - db
+      - redis
+    volumes:
+      - files:/var/www/html
+      - files_player1:/var/www/html/data/player1
+      - files_mindy:/var/www/html/data/mindy
+      - files_jennifer:/var/www/html/data/jennifer
+      - files_michelle:/var/www/html/data/michelle
+      - files_larry:/var/www/html/data/larry
+      - files_ext1:/mnt/ext1
+      - files_ext2:/mnt/ext2
+    restart: "no" 
+    environment:
+      - REDIS_HOST=redis
+      - REDIS_PASSWORD=
+      - PHP_MEMORY_LIMIT=1G
+      - PHP_UPLOAD_LIMIT=12G
+    devices:
+      - /dev/dri:/dev/dri # VA-API (omit for NVENC)
+
+
+  cron:
+    image: nextcloud:30.0.4-apache
+    container_name: ${CONTAINER_NAME}_cron
+    links:
+      - db
+      - redis
+    volumes:
+      - files:/var/www/html
+    restart: "no" 
+    entrypoint: /cron.sh
+
+
+  es01:
+#    image: docker.elastic.co/elasticsearch/elasticsearch:7.17.23
+    image: elasticsearch-ingest:latest 
+    container_name: ${CONTAINER_NAME}_es 
+    environment:
+      - node.name=es01
+      - discovery.type=single-node
+    ulimits:
+      memlock:
+        soft: -1
+        hard: -1
+    volumes:
+      - es_index:/usr/share/elasticsearch/data
+    restart: "no" 
+    ports:
+      - 9200:9200
+
+
+  av:
+    container_name: ${CONTAINER_NAME}_clamav 
+    image: mkodockx/docker-clamav:alpine
+    restart: "no" 
+    ports:
+      - 3310:3310
+    volumes:
+      - clamav:/etc/clamav
+
+
+  onlyoffice:
+    container_name: ${CONTAINER_NAME}_onlyoffice
+    image: onlyoffice/documentserver:latest
+    restart: "no"
+    environment:
+      - JWT_SECRET=secret
+    ports:
+      - 9980:80
+    volumes:
+      - oo_data:/var/www/onlyoffice/Data
+      - oo_data:/var/log/onlyoffice
+
+
+  go-vod:
+    container_name: ${CONTAINER_NAME}_govod
+    image: radialapps/go-vod
+    restart: "no" 
+    init: true
+    depends_on:
+      - app 
+    environment:
+      - NEXTCLOUD_HOST=${NEXTCLOUD_HOST}
+      # - NEXTCLOUD_ALLOW_INSECURE=1 # (self-signed certs or no HTTPS)
+      - NVIDIA_VISIBLE_DEVICES=all
+    devices:
+      - /dev/dri:/dev/dri # VA-API (omit for NVENC)
+    volumes:
+      - files:/var/www/html:ro
+
+
+networks:
+  default:
+      

+ 107 - 0
restore_db.sh

@@ -0,0 +1,107 @@
+#!/bin/bash
+# Docker Volume Restore Script
+#
+# This script is designed to restore Docker volumes from backup files. 
+# It allows you to specify a backup directory, a timestamp for the backup files, 
+# and a list of original and new volume names. The script ensures that the number of original volumes 
+# matches the number of new volumes and provides an option for a dry-run to simulate the restore process without making any changes.
+#
+# Prerequisites
+#
+#
+#    Docker: Ensure Docker is installed and running on your system.
+#    Backup Files: The backup files should be in the specified backup directory and follow the naming convention: <volume_name>_backup-<timestamp>.tar.bz2.
+#
+# Script Variables
+#
+#    BACKUP_DIR: The directory where the backup files are stored. Update this to your desired backup directory.
+#    TIMESTAMP: The timestamp used in the backup file names. Replace this with your desired timestamp.
+#    VOLUMES: An array of original volume names that were backed up.
+#    NEW_VOLUMES: An array of new volume names to which the backups will be restored.
+#
+# Usage
+#
+#    Set Variables: Update the BACKUP_DIR, TIMESTAMP, VOLUMES, and NEW_VOLUMES variables in the script to match your environment.
+#
+#    Run the Script:
+#        To perform a dry-run (simulate the restore process without making changes):
+#
+#	./restore_volumes.sh --dry-run
+#
+#    To perform the actual restore:
+#
+#	./restore_volumes.sh
+#
+#
+
+
+# Variables
+BACKUP_DIR="/media/yazoo/nextcloud_files/backup/nc2/docker_volumes"  # Change this to your desired backup directory
+#TIMESTAMP="20250201_015158"  # Replace with your desired timestamp
+TIMESTAMP="20250219_194346"  # Replace with your desired timestamp
+
+
+# List of volumes to restore
+VOLUME=nc5
+NEW_VOLUME=nc6
+VOLUMES=("${VOLUME}_db" )  # Replace with your original volume names
+NEW_VOLUMES=("${NEW_VOLUME}_db")  # Replace with your new volume names
+
+# Ensure backup directory exists
+mkdir -p "$BACKUP_DIR"
+
+# Check if the number of original volumes matches the number of new volumes
+if [ ${#VOLUMES[@]} -ne ${#NEW_VOLUMES[@]} ]; then
+  echo "Error: Number of original volumes does not match the number of new volumes!"
+  exit 1
+fi
+
+# Parse command-line options
+while [ $# -gt 0 ]; do
+  case $1 in
+    --dry-run)
+      DRY_RUN=1
+      ;;
+    *)
+      echo "Error: Unknown option: $1"
+      exit 1
+      ;;
+  esac
+  shift
+done
+
+# Loop through each volume and perform the restore
+for ((i=0; i<${#VOLUMES[@]}; i++)); do
+  # Define the backup file name
+  BACKUP_FILE="$BACKUP_DIR/${VOLUMES[$i]}_backup-${TIMESTAMP}.tar.bz2"
+
+  # Check if the backup file exists
+  if [ ! -f "$BACKUP_FILE" ]; then
+    echo "Backup file not found: $BACKUP_FILE"
+    exit 1
+  fi
+
+  # Create a new volume (only if not in dry-run mode)
+  if [ -z "$DRY_RUN" ]; then
+    docker volume create "${NEW_VOLUMES[$i]}"
+  fi
+
+  # Print a message indicating the restore operation (only if in dry-run mode)
+  if [ -n "$DRY_RUN" ]; then
+    echo "Would restore volume: ${VOLUMES[$i]} to ${NEW_VOLUMES[$i]} from $BACKUP_FILE"
+  else
+    # Create a temporary container to restore the volume
+    echo "Restoring volume: ${VOLUMES[$i]} to ${NEW_VOLUMES[$i]} from $BACKUP_FILE"
+    docker run -v "${NEW_VOLUMES[$i]}:/volume" -v "$BACKUP_DIR:/backup" --rm loomchild/volume-backup restore -v ${VOLUMES[$i]}_backup-${TIMESTAMP}
+
+    # Check if the restore was successful
+    if [ $? -eq 0 ]; then
+      echo "Restore completed successfully: ${VOLUMES[$i]} to ${NEW_VOLUMES[$i]}"
+    else
+      echo "Restore failed for volume: ${VOLUMES[$i]} to ${NEW_VOLUMES[$i]}!"
+      exit 1
+    fi
+  fi
+done
+
+echo "All restores completed successfully!"

+ 6 - 4
restore_volumes.sh

@@ -36,13 +36,15 @@
 
 
 # Variables
-BACKUP_DIR="/media/orbitzs/nextcloud_files/backup/nc2/docker_volumes"  # Change this to your desired backup directory
-TIMESTAMP="20250201_015158"  # Replace with your desired timestamp
+#BACKUP_DIR="/media/yazoo/nextcloud_files/backup/nc2/docker_volumes"  # Change this to your desired backup directory
+BACKUP_DIR="/media/yazoo/wdcrypt/2025-docker-data-migration/temp-nc5-backup"  # Change this to your desired backup directory
+#TIMESTAMP="20250201_015158"  # Replace with your desired timestamp
+TIMESTAMP="20250219_194346"  # Replace with your desired timestamp
 
 
 # List of volumes to restore
-VOLUME=nc4
-NEW_VOLUME=nc5
+VOLUME=nc5
+NEW_VOLUME=nc6
 VOLUMES=("${VOLUME}_files" "${VOLUME}_oo_data"  "${VOLUME}_es_index" "${VOLUME}_db" "${VOLUME}_clamav")  # Replace with your original volume names
 NEW_VOLUMES=(${NEW_VOLUME}_files "${NEW_VOLUME}_oo_data"  "${NEW_VOLUME}_es_index" "${NEW_VOLUME}_db" "${NEW_VOLUME}_clamav")  # Replace with your new volume names