Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
Clubphp
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Clubphp
Commits
6b497a21
Commit
6b497a21
authored
Apr 07, 2026
by
Administrator
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update 1 files via Son of Anton
parent
9c247613
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
25 deletions
+30
-25
entrypoint.sh
docker/entrypoint.sh
+30
-25
No files found.
docker/entrypoint.sh
View file @
6b497a21
...
...
@@ -5,47 +5,52 @@ echo "========================================="
echo
" THE CLUB ERP — Container Starting"
echo
"========================================="
# ── Wait for MySQL to be ready ──
echo
"Waiting for MySQL at
${
DB_HOST
}
:
${
DB_PORT
}
..."
MAX_TRIES
=
30
COUNT
=
0
until
mysql
-h
"
${
DB_HOST
}
"
-P
"
${
DB_PORT
}
"
-u
"
${
DB_USER
}
"
-p
"
${
DB_PASS
}
"
-e
"SELECT 1"
&>/dev/null
;
do
COUNT
=
$((
COUNT
+
1
))
if
[
$COUNT
-ge
$MAX_TRIES
]
;
then
echo
"MySQL not ready after
${
MAX_TRIES
}
attempts. Aborting."
exit
1
fi
echo
" Attempt
${
COUNT
}
/
${
MAX_TRIES
}
..."
sleep
2
done
echo
"MySQL is ready!"
# ── Create database if it doesn't exist ──
echo
"Ensuring database '
${
DB_NAME
}
' exists..."
mysql
-h
"
${
DB_HOST
}
"
-P
"
${
DB_PORT
}
"
-u
"
${
DB_USER
}
"
-p
"
${
DB_PASS
}
"
-e
\
"CREATE DATABASE IF NOT EXISTS
\`
${
DB_NAME
}
\`
CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;"
echo
"Database ready!"
# ── Generate .env from environment variables ──
ENV_FILE
=
"/var/www/html/.env"
cat
>
"
$ENV_FILE
"
<<
EOF
cat
>
"
$ENV_FILE
"
<<
E
NVE
OF
APP_URL=
${
APP_URL
:-
http
://localhost
}
APP_DEBUG=
${
APP_DEBUG
:-
true
}
APP_ENV=
${
APP_ENV
:-
local
}
DB_HOST=
${
DB_HOST
:-
localhost
}
DB_PORT=
${
DB_PORT
:-
3306
}
DB_NAME=
${
DB_NAME
:-
the_club_erp
}
DB_USER=
${
DB_USER
:-
root
}
DB_PASS=
${
DB_PASS
:-}
SMS_PROVIDER=
${
SMS_PROVIDER
:-}
SMS_API_KEY=
${
SMS_API_KEY
:-}
SMS_SENDER_ID=
${
SMS_SENDER_ID
:-}
EOF
E
NVE
OF
chown
www-data:www-data
"
$ENV_FILE
"
echo
".env generated!"
# ── Wait for MySQL using PHP (avoids shell escaping issues) ──
echo
"Waiting for MySQL..."
MAX_TRIES
=
30
COUNT
=
0
until
php
-r
"
\$
h='
${
DB_HOST
}
';
\$
P='
${
DB_PORT
}
';
\$
u='
${
DB_USER
}
';
\$
p='
${
DB_PASS
}
';
try { new PDO(
\"
mysql:host=
\$
h;port=
\$
P
\"
,
\$
u,
\$
p); echo 'OK'; exit(0); }
catch(Exception
\$
e) { exit(1); }
"
2>/dev/null
;
do
COUNT
=
$((
COUNT
+
1
))
if
[
$COUNT
-ge
$MAX_TRIES
]
;
then
echo
"MySQL not ready after
${
MAX_TRIES
}
attempts. Starting Apache anyway..."
exec
apache2-foreground
fi
echo
" Attempt
${
COUNT
}
/
${
MAX_TRIES
}
..."
sleep
2
done
echo
"MySQL is ready!"
# ── Create database if needed (using PHP) ──
echo
"Ensuring database '
${
DB_NAME
}
' exists..."
php
-r
"
\$
h='
${
DB_HOST
}
';
\$
P='
${
DB_PORT
}
';
\$
u='
${
DB_USER
}
';
\$
p='
${
DB_PASS
}
';
\$
d='
${
DB_NAME
}
';
\$
pdo = new PDO(
\"
mysql:host=
\$
h;port=
\$
P
\"
,
\$
u,
\$
p);
\$
pdo->exec(
\"
CREATE DATABASE IF NOT EXISTS
\\\`\$
d
\\\`
CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci
\"
);
echo 'Database ready!';
"
# ── Run Migrations ──
echo
"========================================="
echo
"Running Migrations..."
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment