1
0
forked from noxious/server

Renamed file

This commit is contained in:
Dennis Postma 2025-02-07 22:53:38 +01:00
parent e824f0f558
commit 5f02aca6e4
2 changed files with 12 additions and 12 deletions

View File

@ -19,7 +19,7 @@ RUN mkdir -p /run/mysqld /var/lib/mysql && \
WORKDIR /usr/src/app
COPY package*.json ./
COPY docker-start.sh ./start.sh
COPY start.sh ./start.sh
COPY . .
RUN npm ci --only=production && \

View File

@ -10,7 +10,7 @@ cleanup() {
echo "Cleaning up..."
tmux kill-session -t $APP_NAME 2>/dev/null || true
redis-cli shutdown || true
mariadb-admin -u root shutdown || true
mysqladmin -u root shutdown || true
exit 0
}
@ -25,23 +25,23 @@ if ! redis-cli ping > /dev/null 2>&1; then
exit 1
fi
# Start MariaDB
echo "Starting MariaDB..."
mariadbd --user=mysql --datadir=/var/lib/mysql &
# Start MySQL
echo "Starting MySQL..."
mysqld --user=mysql --datadir=/var/lib/mysql &
# Wait for MariaDB with timeout
echo "Waiting for MariaDB to be ready..."
# Wait for MySQL with timeout
echo "Waiting for MySQL to be ready..."
COUNTER=0
while ! mariadb-admin ping -h localhost --silent; do
while ! mysqladmin ping -h localhost --silent; do
if [ $COUNTER -gt $MAX_MYSQL_WAIT ]; then
echo "MariaDB failed to start within $MAX_MYSQL_WAIT seconds"
echo "MySQL failed to start within $MAX_MYSQL_WAIT seconds"
exit 1
fi
echo "Still waiting..."
sleep 2
COUNTER=$((COUNTER+2))
done
echo "MariaDB is ready!"
echo "MySQL is ready!"
# Run migrations with error handling
echo "Running database migrations..."
@ -61,8 +61,8 @@ while true; do
echo "Redis died"
exit 1
fi
if ! mariadb-admin ping -h localhost --silent; then
echo "MariaDB died"
if ! mysqladmin ping -h localhost --silent; then
echo "MySQL died"
exit 1
fi
if ! tmux has-session -t $APP_NAME 2>/dev/null; then