Add Docker and Coolify deployment setup
Add the container configuration, environment templates, and storage settings needed to deploy SPOTA with Docker and Coolify.
This commit is contained in:
33
docker/mysql-init/00-import-spota-databases.sh
Normal file
33
docker/mysql-init/00-import-spota-databases.sh
Normal file
@@ -0,0 +1,33 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
mysql_exec() {
|
||||
mysql -uroot -p"$MYSQL_ROOT_PASSWORD" "$@"
|
||||
}
|
||||
|
||||
import_database() {
|
||||
db_name="$1"
|
||||
create_file="$2"
|
||||
data_file="$3"
|
||||
|
||||
if [ -f "$create_file" ]; then
|
||||
mysql_exec < "$create_file"
|
||||
else
|
||||
mysql_exec -e "CREATE DATABASE IF NOT EXISTS \`$db_name\`;"
|
||||
fi
|
||||
|
||||
if [ -f "$data_file" ]; then
|
||||
mysql_exec "$db_name" < "$data_file"
|
||||
fi
|
||||
}
|
||||
|
||||
import_database "spota_spotadb" "/spota_db/spota_spotadb.create" "/spota_db/spota_spotadb.sql"
|
||||
import_database "spota_konsultasi" "/spota_db/spota_konsultasi.create" "/spota_db/spota_konsultasi.sql"
|
||||
import_database "spota_doxid" "/spota_db/spota_doxid.create" "/spota_db/spota_doxid.sql"
|
||||
import_database "spota_rek_artikel" "/spota_db/spota_rek_artikel.create" "/spota_db/spota_rek_artikel.sql"
|
||||
|
||||
mysql_exec -e "GRANT ALL PRIVILEGES ON \`spota_spotadb\`.* TO '$MYSQL_USER'@'%';"
|
||||
mysql_exec -e "GRANT ALL PRIVILEGES ON \`spota_konsultasi\`.* TO '$MYSQL_USER'@'%';"
|
||||
mysql_exec -e "GRANT ALL PRIVILEGES ON \`spota_doxid\`.* TO '$MYSQL_USER'@'%';"
|
||||
mysql_exec -e "GRANT ALL PRIVILEGES ON \`spota_rek_artikel\`.* TO '$MYSQL_USER'@'%';"
|
||||
mysql_exec -e "FLUSH PRIVILEGES;"
|
||||
Reference in New Issue
Block a user