Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AlekSIS-Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AlekSIS®
Official
AlekSIS-Core
Commits
b07b0833
Verified
Commit
b07b0833
authored
4 years ago
by
Nik | Klampfradler
Browse files
Options
Downloads
Patches
Plain Diff
[Docker] Refactor startup script into functions
parent
8290523b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!539
[Docker] Rewrite startup script t oallow scaling and be modular
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
docker-startup.sh
+42
-39
42 additions, 39 deletions
docker-startup.sh
with
42 additions
and
39 deletions
docker-startup.sh
+
42
−
39
View file @
b07b0833
...
...
@@ -4,6 +4,35 @@ RUN_MODE=${RUN_MODE:-uwsgi}
HTTP_PORT
=
${
HTTP_PORT
:-
8000
}
PREPARE
=
${
PREPARE
:-
1
}
wait_migrations
()
{
echo
-n
"Waiting for migrations to appear"
while
!
aleksis-admin migrate
--check
>
/dev/null 2>&1
;
do
sleep
0.5
echo
-n
.
done
echo
}
wait_database
()
{
echo
-n
"Waiting for database."
while
!
aleksis-admin dbshell
--
-c
"SELECT 1"
>
/dev/null 2>&1
;
do
sleep
0.5
echo
-n
.
done
echo
}
prepare_static
()
{
aleksis-admin compilescss
aleksis-admin collectstatic
--no-input
--clear
}
prepare_database
()
{
aleksis-admin migrate
aleksis-admin createinitialrevisions
}
if
[[
-z
$ALEKSIS_secret_key
]]
;
then
if
[[
!
-e
/var/lib/aleksis/secret_key
]]
;
then
touch
/var/lib/aleksis/secret_key
;
chmod
600 /var/lib/aleksis/secret_key
...
...
@@ -12,58 +41,32 @@ if [[ -z $ALEKSIS_secret_key ]]; then
ALEKSIS_secret_key
=
$(
</var/lib/aleksis/secret_key
)
fi
echo
-n
"Waiting for database."
while
!
aleksis-admin dbshell
--
-c
"SELECT 1"
>
/dev/null 2>&1
;
do
sleep
0.5
echo
-n
.
done
echo
if
[[
$PREPARE
=
1
]]
;
then
aleksis-admin compilescss
aleksis-admin collectstatic
--no-input
--clear
fi
wait_database
case
"
$RUN_MODE
"
in
uwsgi
)
if
[[
$PREPARE
=
1
]]
;
then
aleksis-admin migrat
e
aleksis-admin createinitialrevisions
prepare_databas
e
prepare_static
else
while
!
aleksis-admin migrate
--check
;
do
sleep
0.5
done
wait_migrations
fi
aleksis-admin compilescss
aleksis-admin collectstatic
--no-input
--clear
exec
aleksis-admin runuwsgi
--
--http-socket
=
:
$HTTP_PORT
;;
celery-
worker
)
celery-
*
)
if
[[
$PREPARE
=
1
]]
;
then
aleksis-admin migrate
aleksis-admin createinitialrevisions
prepare_database
else
while
!
aleksis-admin migrate
--check
;
do
sleep
0.5
done
wait_migrations
fi
exec
celery
-A
aleksis.core worker
;;
celery-beat
)
if
[[
$PREPARE
=
1
]]
;
then
aleksis-admin migrate
else
while
!
aleksis-admin migrate
--check
;
do
sleep
0.5
done
fi
exec
celery
-A
aleksis.core beat
exec
celery
-A
aleksis.core
${
RUN_MODE
#celery-
}
;;
prepare
)
aleksis-admin compilescss
aleksis-admin collectstatic
--no-input
--clear
aleksis-admin migrate
aleksis-admin createinitialrevisions
prepare_database
prepare_static
;;
*
)
exec
"
$@
"
;;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment