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
53d0f725
Verified
Commit
53d0f725
authored
4 years ago
by
Nik | Klampfradler
Browse files
Options
Downloads
Patches
Plain Diff
[Docker] Reformat and posixify startup script
parent
b07b0833
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
Pipeline
#6482
passed
4 years ago
Stage: test
Stage: build
Stage: publish
Stage: docker
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
docker-startup.sh
+36
-36
36 additions, 36 deletions
docker-startup.sh
with
36 additions
and
36 deletions
docker-startup.sh
+
36
−
36
View file @
53d0f725
#!/bin/
ba
sh
#!/bin/sh
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
echo
-n
"Waiting for migrations to appear"
until
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
echo
-n
"Waiting for database."
until
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
aleksis-admin compilescss
aleksis-admin collectstatic
--no-input
--clear
}
prepare_database
()
{
aleksis-admin migrate
aleksis-admin createinitialrevisions
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
LC_ALL
=
C
tr
-dc
'A-Za-z0-9!"#$%&'
\'
'()*+,-./:;<=>?@[\]^_`{|}~'
</dev/urandom |
head
-c
64
>
/var/lib/aleksis/secret_key
fi
ALEKSIS_secret_key
=
$(
<
/var/lib/aleksis/secret_key
)
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
LC_ALL
=
C
tr
-dc
'A-Za-z0-9!"#$%&'
\'
'()*+,-./:;<=>?@[\]^_`{|}~'
</dev/urandom |
head
-c
64
>
/var/lib/aleksis/secret_key
fi
ALEKSIS_secret_key
=
$(
cat
/var/lib/aleksis/secret_key
)
fi
wait_database
case
"
$RUN_MODE
"
in
uwsgi
)
if
[
[
$PREPARE
=
1
]
]
;
then
prepare_database
prepare_static
uwsgi
)
if
[
$PREPARE
=
1
]
;
then
prepare_database
prepare_static
else
wait_migrations
wait_migrations
fi
exec
aleksis-admin runuwsgi
--
--http-socket
=
:
$HTTP_PORT
;;
celery-
*
)
if
[
[
$PREPARE
=
1
]
]
;
then
prepare_database
;;
celery-
*
)
if
[
$PREPARE
=
1
]
;
then
prepare_database
else
wait_migrations
wait_migrations
fi
exec
celery
-A
aleksis.core
${
RUN_MODE
#celery-
}
;;
prepare
)
prepare
)
prepare_database
prepare_static
;;
*
)
*
)
exec
"
$@
"
;;
esac
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