Preparation for 1.0.18

This commit is contained in:
Pinga 2025-03-25 14:05:46 +02:00
parent d429a2d058
commit d53f602122
6 changed files with 155 additions and 17 deletions

View file

@ -88,20 +88,17 @@ After installation, be sure to review all the guides in the Documentation sectio
### Updating ### Updating
To update, you **must run the update scripts sequentially** without skipping versions. To update, you **must run the update scripts sequentially** without skipping versions.
For example, if you're on **v1.0.13** and the latest is **v1.0.15**, first update to **v1.0.14**, then to **v1.0.15**. For example, if you're on **v1.0.16** and the latest is **v1.0.18**, first update to **v1.0.17**, then to **v1.0.18**.
- **v1.0.17 → v1.0.18**
Download and run the [`update1018.sh`](docs/update1018.sh) script.
- **v1.0.16 → v1.0.17** - **v1.0.16 → v1.0.17**
Download and run the [`update1017.sh`](docs/update1017.sh) script. Download and run the [`update1017.sh`](docs/update1017.sh) script.
- **v1.0.15 → v1.0.16** - **v1.0.15 → v1.0.16**
Download and run the [`update1016.sh`](docs/update1016.sh) script. Download and run the [`update1016.sh`](docs/update1016.sh) script.
- **v1.0.14 → v1.0.15**
Download and run the [`update1015.sh`](docs/update1015.sh) script.
- **v1.0.13 → v1.0.14**
Download and run the [`update1014.sh`](docs/update1014.sh) script.
For **older versions**, please refer to [`update.md`](docs/update.md). For **older versions**, please refer to [`update.md`](docs/update.md).
### [Configuration Guide](docs/configuration.md) ### [Configuration Guide](docs/configuration.md)

View file

@ -14,7 +14,7 @@
<a href="https://namingo.org" target="_blank" class="link-secondary" rel="noopener">Namingo</a> <a href="https://namingo.org" target="_blank" class="link-secondary" rel="noopener">Namingo</a>
</li> </li>
<li class="list-inline-item"> <li class="list-inline-item">
v1.0.17 v1.0.18
</li> </li>
</ul> </ul>
</div> </div>

View file

@ -61,7 +61,7 @@ fi
# --- Minimum requirements check --- # --- Minimum requirements check ---
MIN_RAM_MB=2048 MIN_RAM_MB=2000
MIN_DISK_GB=10 MIN_DISK_GB=10
# (Assumes that the "free" and "df" commands are available.) # (Assumes that the "free" and "df" commands are available.)
@ -102,7 +102,7 @@ apk update
# Install common packages. (readline gnupg missing) # Install common packages. (readline gnupg missing)
apk add \ apk add \
bash curl caddy gettext icu-data-full git php83-phar gnupg net-tools pv redis unzip wget whois ufw tzdata \ bash curl caddy gettext icu-data-full git php83-phar gnupg net-tools pv redis unzip wget whois ufw tzdata \
php83 php83-fpm php83-common php83-curl php83-fileinfo php83-iconv php83-dom php83-gd php83-ftp php83-gmp php83-bcmath php83-mysqli \ php83 php83-fpm php83-common php83-curl php83-fileinfo php83-pdo php83-pdo_mysql php83-ctype nano php83-iconv php83-dom php83-gd php83-ftp php83-gmp php83-bcmath php83-mysqli \
php83-pecl-igbinary php83-imap php83-intl php83-mbstring php83-opcache php83-pecl-redis \ php83-pecl-igbinary php83-imap php83-intl php83-mbstring php83-opcache php83-pecl-redis \
php83-soap php83-xml \ php83-soap php83-xml \
php83-pecl-ds php83-pecl-swoole php83-pecl-uuid \ php83-pecl-ds php83-pecl-swoole php83-pecl-uuid \
@ -177,7 +177,7 @@ ln -sf /usr/share/adminer/latest.php /usr/share/adminer/adminer.php
# --- Clone registry source code --- # --- Clone registry source code ---
echo "Cloning registry source code..." echo "Cloning registry source code..."
git clone --branch v1.0.17 --single-branch https://github.com/getnamingo/registry /opt/registry git clone --branch v1.0.18 --single-branch https://github.com/getnamingo/registry /opt/registry
# --- Firewall configuration using ufw --- # --- Firewall configuration using ufw ---
echo "Configuring firewall rules..." echo "Configuring firewall rules..."
@ -309,7 +309,7 @@ EOF
# Create log directory and adjust permissions # Create log directory and adjust permissions
mkdir -p /var/log/namingo mkdir -p /var/log/namingo
chown -R www-data:www-data /var/log/namingo chown -R caddy:caddy /var/log/namingo
touch /var/log/namingo/web-cp.log touch /var/log/namingo/web-cp.log
chown caddy:caddy /var/log/namingo/web-cp.log chown caddy:caddy /var/log/namingo/web-cp.log
touch /var/log/namingo/web-whois.log touch /var/log/namingo/web-whois.log
@ -423,7 +423,7 @@ php /var/www/cp/bin/create_admin_user.php
echo "Downloading initial data and setting up cache..." echo "Downloading initial data and setting up cache..."
php /var/www/cp/bin/file_cache.php php /var/www/cp/bin/file_cache.php
chown www-data:www-data /var/www/cp/cache chown caddy:caddy /var/www/cp/cache
echo -e "Installation complete!\n" echo -e "Installation complete!\n"
echo -e "Next steps:\n" echo -e "Next steps:\n"

View file

@ -38,7 +38,7 @@ if [[ $EUID -ne 0 ]]; then
fi fi
# Minimum requirements # Minimum requirements
MIN_RAM_MB=2048 MIN_RAM_MB=2000
MIN_DISK_GB=10 MIN_DISK_GB=10
# Get the available RAM in MB # Get the available RAM in MB
@ -246,7 +246,7 @@ EOF
wget "http://www.adminer.org/latest.php" -O /usr/share/adminer/latest.php wget "http://www.adminer.org/latest.php" -O /usr/share/adminer/latest.php
ln -s /usr/share/adminer/latest.php /usr/share/adminer/adminer.php ln -s /usr/share/adminer/latest.php /usr/share/adminer/adminer.php
git clone --branch v1.0.17 --single-branch https://github.com/getnamingo/registry /opt/registry git clone --branch v1.0.18 --single-branch https://github.com/getnamingo/registry /opt/registry
echo "Setting up firewall rules..." echo "Setting up firewall rules..."
ufw allow 22/tcp ufw allow 22/tcp

View file

@ -1,9 +1,13 @@
# Namingo Update Guide # Namingo Update Guide
## v1.0.0 to v1.0.13 ## v1.0.0 to v1.0.15
You must run update scripts in order, without skipping versions. For example, if you're on 1.0.10 and the latest is 1.0.12, first update to 1.0.11, then to 1.0.12. You must run update scripts in order, without skipping versions. For example, if you're on 1.0.10 and the latest is 1.0.12, first update to 1.0.11, then to 1.0.12.
- v1.0.14 to v1.0.15 - download and run the [update1015.sh](docs/update1015.sh) script.
- v1.0.13 to v1.0.14 - download and run the [update1014.sh](docs/update1014.sh) script.
- v1.0.12 to v1.0.13 - download and run the [update1013.sh](docs/update1013.sh) script. - v1.0.12 to v1.0.13 - download and run the [update1013.sh](docs/update1013.sh) script.
- v1.0.11 to v1.0.12 - download and run the [update1012.sh](docs/update1012.sh) script. - v1.0.11 to v1.0.12 - download and run the [update1012.sh](docs/update1012.sh) script.

137
docs/update1018.sh Normal file
View file

@ -0,0 +1,137 @@
#!/bin/bash
# Ensure the script is run as root
if [[ $EUID -ne 0 ]]; then
echo "Error: This update script must be run as root or with sudo." >&2
exit 1
fi
# Prompt the user for confirmation
echo "This will update Namingo Registry from v1.0.17 to v1.0.18."
echo "Make sure you have a backup of the database, /var/www/cp, and /opt/registry."
read -p "Are you sure you want to proceed? (y/n): " confirm
# Check user input
if [[ "$confirm" != "y" ]]; then
echo "Upgrade aborted."
exit 0
fi
# Create backup directory
backup_dir="/opt/backup"
mkdir -p "$backup_dir"
# Backup directories
echo "Creating backups..."
tar -czf "$backup_dir/cp_backup_$(date +%F).tar.gz" -C / var/www/cp
tar -czf "$backup_dir/whois_backup_$(date +%F).tar.gz" -C / var/www/whois
tar -czf "$backup_dir/registry_backup_$(date +%F).tar.gz" -C / opt/registry
# Database credentials
config_file="/opt/registry/whois/port43/config.php"
db_user=$(grep "'db_username'" "$config_file" | awk -F "=> '" '{print $2}' | sed "s/',//")
db_pass=$(grep "'db_password'" "$config_file" | awk -F "=> '" '{print $2}' | sed "s/',//")
db_host=$(grep "'db_host'" "$config_file" | awk -F "=> '" '{print $2}' | sed "s/',//")
# List of databases to back up
databases=("registry" "registryAudit" "registryTransaction")
# Backup specific databases
for db_name in "${databases[@]}"; do
echo "Backing up database $db_name..."
sql_backup_file="$backup_dir/db_${db_name}_backup_$(date +%F).sql"
mysqldump -u"$db_user" -p"$db_pass" -h"$db_host" "$db_name" > "$sql_backup_file"
# Compress the SQL backup file
echo "Compressing database backup $db_name..."
tar -czf "${sql_backup_file}.tar.gz" -C "$backup_dir" "$(basename "$sql_backup_file")"
# Remove the uncompressed SQL file
rm "$sql_backup_file"
done
# Stop services
echo "Stopping services..."
systemctl stop caddy
systemctl stop epp
systemctl stop whois
systemctl stop rdap
systemctl stop das
systemctl stop msg_producer
systemctl stop msg_worker
# Clear cache
echo "Clearing cache..."
php /var/www/cp/bin/clear_cache.php
# Clone the new version of the repository
echo "Cloning v1.0.18 from the repository..."
git clone --branch v1.0.18 --single-branch https://github.com/getnamingo/registry /opt/registry1018
# Copy files from the new version to the appropriate directories
echo "Copying files..."
# Function to copy files and maintain directory structure
copy_files() {
src_dir=$1
dest_dir=$2
if [[ -d "$src_dir" ]]; then
echo "Copying from $src_dir to $dest_dir..."
cp -R "$src_dir/." "$dest_dir/"
else
echo "Source directory $src_dir does not exist. Skipping..."
fi
}
# Copy specific directories
copy_files "/opt/registry1018/automation" "/opt/registry/automation"
copy_files "/opt/registry1018/cp" "/var/www/cp"
copy_files "/opt/registry1018/whois/web" "/var/www/whois"
copy_files "/opt/registry1018/das" "/opt/registry/das"
copy_files "/opt/registry1018/whois/port43" "/opt/registry/whois/port43"
copy_files "/opt/registry1018/rdap" "/opt/registry/rdap"
copy_files "/opt/registry1018/epp" "/opt/registry/epp"
copy_files "/opt/registry1018/docs" "/opt/registry/docs"
# Run composer update in copied directories (excluding docs)
echo "Running composer update..."
composer_update() {
dir=$1
if [[ -d "$dir" ]]; then
echo "Updating composer in $dir..."
cd "$dir" || exit
COMPOSER_ALLOW_SUPERUSER=1 composer update --no-interaction --quiet
else
echo "Directory $dir does not exist. Skipping composer update..."
fi
}
# Update composer in relevant directories
composer_update "/opt/registry/automation"
composer_update "/var/www/cp"
composer_update "/opt/registry/das"
composer_update "/opt/registry/whois/port43"
composer_update "/opt/registry/rdap"
composer_update "/opt/registry/epp"
# Start services
echo "Starting services..."
systemctl start epp
systemctl start whois
systemctl start rdap
systemctl start das
systemctl start caddy
systemctl start msg_producer
systemctl start msg_worker
# Check if services started successfully
if [[ $? -eq 0 ]]; then
echo "Services started successfully. Deleting /opt/registry1018..."
rm -rf /opt/registry1018
else
echo "There was an issue starting the services. /opt/registry1018 will not be deleted."
fi
echo "Upgrade to v1.0.18 completed successfully."