mirror of
https://github.com/getnamingo/registry.git
synced 2025-05-16 17:46:59 +02:00
1.0.14 hotfix
This commit is contained in:
parent
181e3738a7
commit
ddfb8fed75
5 changed files with 144 additions and 4 deletions
|
@ -91,6 +91,8 @@ After installation, be sure to review all the guides in the Documentation sectio
|
|||
|
||||
If your current version is not immediately before the latest, you must run the update scripts sequentially for each version, e.g., from 1.0.3 to 1.0.4, then from 1.0.4 to 1.0.5, and so on, until you reach the latest version.
|
||||
|
||||
- v1.0.13 to v1.0.14 - backup registry, download and run the [update1014.sh](docs/update1014.sh) script.
|
||||
|
||||
- v1.0.12 to v1.0.13 - backup registry, download and run the [update1013.sh](docs/update1013.sh) script.
|
||||
|
||||
- v1.0.11 to v1.0.12 - backup registry, download and run the [update1012.sh](docs/update1012.sh) script.
|
||||
|
|
|
@ -12,7 +12,6 @@ declare(strict_types=1);
|
|||
use Swoole\Http\Server;
|
||||
use Swoole\Http\Request;
|
||||
use Swoole\Http\Response;
|
||||
use Swoole\Coroutine\Redis;
|
||||
|
||||
require __DIR__ . '/vendor/autoload.php';
|
||||
|
||||
|
@ -39,7 +38,7 @@ class RedisPool {
|
|||
public function initialize(int $size = 10): void {
|
||||
for ($i = 0; $i < $size; $i++) {
|
||||
// Create a coroutine for each connection.
|
||||
Swoole\Coroutine::create(function () {
|
||||
Swoole\Coroutine\run(function () {
|
||||
$redis = new Redis();
|
||||
if (!$redis->connect($this->host, $this->port)) {
|
||||
throw new Exception("Failed to connect to Redis at {$this->host}:{$this->port}");
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
<a href="https://namingo.org" target="_blank" class="link-secondary" rel="noopener">Namingo</a>
|
||||
</li>
|
||||
<li class="list-inline-item">
|
||||
v1.0.13
|
||||
v1.0.14
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
@ -246,7 +246,7 @@ EOF
|
|||
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
|
||||
|
||||
git clone --branch v1.0.13 --single-branch https://github.com/getnamingo/registry /opt/registry
|
||||
git clone --branch v1.0.14 --single-branch https://github.com/getnamingo/registry /opt/registry
|
||||
mkdir -p /var/log/namingo
|
||||
chown -R www-data:www-data /var/log/namingo
|
||||
|
||||
|
|
139
docs/update1014.sh
Normal file
139
docs/update1014.sh
Normal file
|
@ -0,0 +1,139 @@
|
|||
#!/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.13 to v1.0.14."
|
||||
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.14 from the repository..."
|
||||
git clone --branch v1.0.14 --single-branch https://github.com/getnamingo/registry /opt/registry1014
|
||||
|
||||
# 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/registry1014/automation" "/opt/registry/automation"
|
||||
copy_files "/opt/registry1014/cp" "/var/www/cp"
|
||||
copy_files "/opt/registry1014/whois/web" "/var/www/whois"
|
||||
copy_files "/opt/registry1014/das" "/opt/registry/das"
|
||||
copy_files "/opt/registry1014/whois/port43" "/opt/registry/whois/port43"
|
||||
copy_files "/opt/registry1014/rdap" "/opt/registry/rdap"
|
||||
copy_files "/opt/registry1014/epp" "/opt/registry/epp"
|
||||
copy_files "/opt/registry1014/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/registry1014..."
|
||||
rm -rf /opt/registry1014
|
||||
else
|
||||
echo "There was an issue starting the services. /opt/registry1014 will not be deleted."
|
||||
fi
|
||||
|
||||
echo "Upgrade to v1.0.14 completed successfully."
|
||||
echo "Please restart your Message Broker with:"
|
||||
echo "systemctl restart msg_producer"
|
Loading…
Add table
Add a link
Reference in a new issue