Major upgrade and refactor
This commit is contained in:
parent
a3b780efe0
commit
3b4cd5c128
@ -1,3 +1,4 @@
|
|||||||
.git
|
.git
|
||||||
SabrehavenServer.tar.gz
|
SabrehavenServer.tar.gz
|
||||||
ZnoteAAC.tar.gz
|
ZnoteAAC.tar.gz
|
||||||
|
pma_install.sh.bak
|
||||||
|
@ -9,10 +9,13 @@ GRANT ALL PRIVILEGES ON forgottenserver.* TO 'forgottenserver'@'localhost';
|
|||||||
FLUSH PRIVILEGES;
|
FLUSH PRIVILEGES;
|
||||||
|
|
||||||
-- forgottenserver database schema installation
|
-- forgottenserver database schema installation
|
||||||
SOURCE '/home/tibia/SabrehavenServer/sabrehaven.sql';
|
USE forgottenserver;
|
||||||
|
SOURCE /home/tibia/SabrehavenServer/sabrehaven.sql;
|
||||||
|
|
||||||
-- ZnoteAAC database schema installation
|
-- ZnoteAAC database schema installation
|
||||||
SOURCE '/var/www/ZnoteAAC/engine/database/znote_schema.sql';
|
USE forgottenserver;
|
||||||
|
SOURCE /var/www/ZnoteAAC/engine/database/znote_schema.sql;
|
||||||
|
|
||||||
-- Install sabrehaven_znote.sql for Sabrehaven usage
|
-- Install sabrehaven_znote.sql for Sabrehaven usage
|
||||||
SOURCE '/home/tibia/SabrehavenServer/sabrehaven_znote.sql';
|
USE forgottenserver;
|
||||||
|
SOURCE /home/tibia/SabrehavenServer/sabrehaven_znote.sql;
|
2
app/1mindeploy/DBCI.sh
Normal file
2
app/1mindeploy/DBCI.sh
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
mariadb -u root < '/home/tibia/1mindeploy/DATABASE_CREATION_AND_INSTALLATION.sql'
|
4
app/1mindeploy/entrypoint.sh
Executable file
4
app/1mindeploy/entrypoint.sh
Executable file
@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
service mariadb start > /dev/null 2>&1
|
||||||
|
service apache2 start > /dev/null 2>&1
|
||||||
|
/bin/sh
|
68
app/1mindeploy/pma_install.sh
Executable file
68
app/1mindeploy/pma_install.sh
Executable file
@ -0,0 +1,68 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Ensure the script runs with root privileges
|
||||||
|
if [ "$(id -u)" -ne 0 ]; then
|
||||||
|
echo "This script must be run as root" 1>&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Update package list and install necessary packages
|
||||||
|
apt-get update -y
|
||||||
|
apt-get install -y apache2 mysql-server php libapache2-mod-php php-mysqli php-json php-common php-mbstring php-zip php-xml php-gd php-curl php-bz2 php-ldap php-imagick
|
||||||
|
|
||||||
|
# Automatically select Apache2 during phpMyAdmin installation (without user intervention)
|
||||||
|
echo "phpmyadmin phpmyadmin/webserver select apache2" | debconf-set-selections
|
||||||
|
|
||||||
|
# Install phpMyAdmin (with no user interaction)
|
||||||
|
DEBIAN_FRONTEND=noninteractive apt-get install -y phpmyadmin
|
||||||
|
|
||||||
|
# Generate a random password for phpMyAdmin user
|
||||||
|
phpmyadmin_password=$(openssl rand -base64 12)
|
||||||
|
|
||||||
|
# Set the MySQL root password (if not already set)
|
||||||
|
mysql_root_password=$(openssl rand -base64 12)
|
||||||
|
|
||||||
|
# Set MySQL root password if not already set
|
||||||
|
echo "Setting MySQL root password"
|
||||||
|
mysqladmin -u root password "$mysql_root_password"
|
||||||
|
|
||||||
|
# Check if the phpmyadmin user already exists and drop it if it does
|
||||||
|
echo "Checking if phpMyAdmin user exists"
|
||||||
|
existing_user=$(mysql -u root -p"$mysql_root_password" -e "SELECT COUNT(*) FROM mysql.user WHERE User = 'phpmyadmin';" | tail -n 1)
|
||||||
|
|
||||||
|
if [ "$existing_user" -gt 0 ]; then
|
||||||
|
echo "Dropping existing phpMyAdmin user"
|
||||||
|
mysql -u root -p"$mysql_root_password" -e "DROP USER IF EXISTS 'phpmyadmin'@'localhost';"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Create phpMyAdmin user with mysql_native_password plugin
|
||||||
|
echo "Creating phpMyAdmin user"
|
||||||
|
mysql -u root -p"$mysql_root_password" -e "CREATE USER 'phpmyadmin'@'localhost' IDENTIFIED BY '$phpmyadmin_password';"
|
||||||
|
|
||||||
|
# Grant privileges to phpMyAdmin user
|
||||||
|
echo "Granting privileges to phpMyAdmin user"
|
||||||
|
mysql -u root -p"$mysql_root_password" -e "GRANT ALL PRIVILEGES ON phpmyadmin.* TO 'phpmyadmin'@'localhost';"
|
||||||
|
mysql -u root -p"$mysql_root_password" -e "FLUSH PRIVILEGES;"
|
||||||
|
|
||||||
|
# Link phpMyAdmin to Apache's web directory (optional)
|
||||||
|
# ln -s /usr/share/phpmyadmin /var/www/html/phpmyadmin # Uncomment if necessary
|
||||||
|
|
||||||
|
# Configure Apache to automatically restart and reconfigure
|
||||||
|
echo "Reconfiguring Apache to apply changes"
|
||||||
|
a2enmod rewrite
|
||||||
|
|
||||||
|
# Enable PHP module (adjust according to PHP version installed)
|
||||||
|
a2enmod php7.4 # Adjust according to the PHP version installed (e.g., php7.4, php8.0)
|
||||||
|
|
||||||
|
# Restart Apache to apply changes
|
||||||
|
service apache2 restart
|
||||||
|
cp /home/tibia/1mindeploy/phpmyadmin.conf /etc/apache2/conf-available
|
||||||
|
a2enconf phpmyadmin
|
||||||
|
|
||||||
|
# Output phpMyAdmin password and MySQL root password for user reference
|
||||||
|
#echo "phpMyAdmin user created with the following password: $phpmyadmin_password"
|
||||||
|
echo "MySQL root password: $mysql_root_password"
|
||||||
|
|
||||||
|
# Clean up and remove unnecessary packages
|
||||||
|
#apt-get clean
|
||||||
|
|
68
app/1mindeploy/pma_install.sh.bak
Executable file
68
app/1mindeploy/pma_install.sh.bak
Executable file
@ -0,0 +1,68 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Ensure the script runs with root privileges
|
||||||
|
if [ "$(id -u)" -ne 0 ]; then
|
||||||
|
echo "This script must be run as root" 1>&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Update package list and install necessary packages
|
||||||
|
apt-get update -y
|
||||||
|
apt-get install -y apache2 mysql-server php libapache2-mod-php php-mysqli php-json php-common php-mbstring php-zip php-xml php-gd php-curl php-bz2 php-ldap php-imagick
|
||||||
|
|
||||||
|
# Automatically select Apache2 during phpMyAdmin installation (without user intervention)
|
||||||
|
echo "phpmyadmin phpmyadmin/webserver select apache2" | debconf-set-selections
|
||||||
|
|
||||||
|
# Install phpMyAdmin (with no user interaction)
|
||||||
|
DEBIAN_FRONTEND=noninteractive apt-get install -y phpmyadmin
|
||||||
|
|
||||||
|
# Generate a random password for phpMyAdmin user
|
||||||
|
phpmyadmin_password=$(openssl rand -base64 12)
|
||||||
|
|
||||||
|
# Set the MySQL root password (if not already set)
|
||||||
|
mysql_root_password=$(openssl rand -base64 12)
|
||||||
|
|
||||||
|
# Set MySQL root password if not already set
|
||||||
|
echo "Setting MySQL root password"
|
||||||
|
mysqladmin -u root password "$mysql_root_password"
|
||||||
|
|
||||||
|
# Check if the phpmyadmin user already exists and drop it if it does
|
||||||
|
echo "Checking if phpMyAdmin user exists"
|
||||||
|
existing_user=$(mysql -u root -p"$mysql_root_password" -e "SELECT COUNT(*) FROM mysql.user WHERE User = 'phpmyadmin';" | tail -n 1)
|
||||||
|
|
||||||
|
if [ "$existing_user" -gt 0 ]; then
|
||||||
|
echo "Dropping existing phpMyAdmin user"
|
||||||
|
mysql -u root -p"$mysql_root_password" -e "DROP USER IF EXISTS 'phpmyadmin'@'localhost';"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Create phpMyAdmin user with mysql_native_password plugin
|
||||||
|
echo "Creating phpMyAdmin user"
|
||||||
|
mysql -u root -p"$mysql_root_password" -e "CREATE USER 'phpmyadmin'@'localhost' IDENTIFIED BY '$phpmyadmin_password';"
|
||||||
|
|
||||||
|
# Grant privileges to phpMyAdmin user
|
||||||
|
echo "Granting privileges to phpMyAdmin user"
|
||||||
|
mysql -u root -p"$mysql_root_password" -e "GRANT ALL PRIVILEGES ON phpmyadmin.* TO 'phpmyadmin'@'localhost';"
|
||||||
|
mysql -u root -p"$mysql_root_password" -e "FLUSH PRIVILEGES;"
|
||||||
|
|
||||||
|
# Link phpMyAdmin to Apache's web directory (optional)
|
||||||
|
# ln -s /usr/share/phpmyadmin /var/www/html/phpmyadmin # Uncomment if necessary
|
||||||
|
|
||||||
|
# Configure Apache to automatically restart and reconfigure
|
||||||
|
echo "Reconfiguring Apache to apply changes"
|
||||||
|
a2enmod rewrite
|
||||||
|
|
||||||
|
# Enable PHP module (adjust according to PHP version installed)
|
||||||
|
a2enmod php7.4 # Adjust according to the PHP version installed (e.g., php7.4, php8.0)
|
||||||
|
|
||||||
|
# Restart Apache to apply changes
|
||||||
|
service apache2 restart
|
||||||
|
cp phpmyadmin.conf /etc/apache2/conf-available
|
||||||
|
a2enconf phpmyadmin
|
||||||
|
|
||||||
|
# Output phpMyAdmin password and MySQL root password for user reference
|
||||||
|
echo "phpMyAdmin user created with the following password: $phpmyadmin_password"
|
||||||
|
echo "MySQL root password: $mysql_root_password"
|
||||||
|
|
||||||
|
# Clean up and remove unnecessary packages
|
||||||
|
#apt-get clean
|
||||||
|
|
25
dockerfile
25
dockerfile
@ -10,11 +10,24 @@ RUN echo "tibia:tibia" | chpasswd
|
|||||||
WORKDIR /home/tibia
|
WORKDIR /home/tibia
|
||||||
|
|
||||||
COPY app/ZnoteAAC /var/www/ZnoteAAC
|
COPY app/ZnoteAAC /var/www/ZnoteAAC
|
||||||
COPY app/SabrehavenServer /home/tibia
|
COPY app/SabrehavenServer /home/tibia/SabrehavenServer
|
||||||
RUN chown -R tibia:tibia /home/tibia
|
COPY app/1mindeploy /home/tibia/1mindeploy
|
||||||
RUN chown -R www-data:www-data /var/www/ZnoteAAC
|
RUN chown -R tibia:tibia /home/tibia && chown -R www-data:www-data /var/www/ZnoteAAC
|
||||||
|
|
||||||
ENTRYPOINT ["/bin/bash"]
|
RUN chown -R tibia:tibia /home/tibia && chmod a+x /home/tibia/1mindeploy/DBCI.sh && service mariadb start && /home/tibia/1mindeploy/DBCI.sh
|
||||||
|
|
||||||
USER tibia
|
ENTRYPOINT ["/home/tibia/1mindeploy/entrypoint.sh"]
|
||||||
ENV TIBIA_VERSION="8.0"
|
|
||||||
|
USER root
|
||||||
|
#USER tibia
|
||||||
|
ENV TIBIA_VERSION="7.92"
|
||||||
|
ENV DB_USER="forgottenserver"
|
||||||
|
ENV DB_PASSWORD="forgotten"
|
||||||
|
ENV DB_DATABASE="forgottenserver"
|
||||||
|
ENV MYSQLSOCK="/run/mysqld/mysqld.sock"
|
||||||
|
|
||||||
|
ENV BIND_ONLY_GLOBAL_ADDRESS="false"
|
||||||
|
ENV PUBLIC_IP="127.0.0.1"
|
||||||
|
ENV LOGIN_PROTOCOL_PORT="7171"
|
||||||
|
ENV GAME_PROTOCOL_PORT="7172"
|
||||||
|
ENV STATUS_PROTOCOL_PORT="7171"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user