Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
engine-api
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AURA
engine-api
Commits
5d48a978
Commit
5d48a978
authored
4 years ago
by
David Trattnig
Browse files
Options
Downloads
Patches
Plain Diff
Initial commit.
parent
797ea910
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
run.sh
+117
-0
117 additions, 0 deletions
run.sh
with
117 additions
and
0 deletions
run.sh
0 → 100755
+
117
−
0
View file @
5d48a978
#!/bin/bash
# Default mode
mode
=
"api-dev"
docker
=
"false"
#
# Run Script for AURA Engine API
#
# Call with one of these parameters:
#
# - api-dev
# - api
# - recreate-database
# - docker:recreate-database
# - docker:build
# - docker:push
# - docker:api
#
if
[[
$*
=
~ ^
(
api-dev|api
)
$
]]
;
then
mode
=
$1
fi
if
[[
"
$1
"
==
*
"docker:"
*
]]
;
then
docker
=
"true"
mode
=
${
1
#*
:
}
fi
echo
"[ Run mode=
$mode
]"
echo
"[ Docker=
$docker
]"
# +++ DEFAULT COMMANDS +++ #
if
[[
$docker
==
"false"
]]
;
then
### Runs the API Server (Development) ###
if
[[
$mode
==
"api-dev"
]]
;
then
# echo "Building Web Applications"
# sh ./script/build-web.sh
echo
"Starting API Server"
/usr/bin/env python3.7
-m
src
fi
### Runs the API Server using Gunicorn without a system daemon (Production) ###
if
[[
$mode
==
"api"
]]
;
then
echo
"Activating Python Environment"
source
../python-env/bin/activate
echo
"Starting API Server"
gunicorn
-c
configuration/gunicorn.conf.py src:app
fi
### CAUTION: This deletes everything in your database ###
if
[[
$mode
==
"recreate-database"
]]
;
then
/usr/bin/env python3.7
-m
src
--recreate-database
fi
fi
# +++ DOCKER COMMANDS +++ #
if
[[
$docker
==
"true"
]]
;
then
BASE_D
=
$(
realpath
"
${
BASH_SOURCE
%/*
}
/"
)
### Runs Engine API using Gunicorn ###
# if [[ $mode == "api" ]]; then
# exec sudo docker run --name engine-api --rm -it \
# -u $UID:$GID \
# -p 127.0.0.1:8050:5000 \
# -v "$BASE_D":/srv \
# -v "$BASE_D/configuration/":/etc/aura \
# --tmpfs /var/log/aura/ autoradio/engine-api /srv/src/__main__.py \
# --device autoradio/engine-api /bin/bash \
# -c "gunicorn -c configuration/gunicorn.conf.py -m src:app"
# fi
if
[[
$mode
==
"api"
]]
;
then
exec sudo
docker run
--name
engine-api
--rm
-it
\
-u
$UID
:
$GID
\
-p
127.0.0.1:8050:5000
\
-v
"
$BASE_D
"
:/srv
\
-v
"
$BASE_D
/configuration/"
:/etc/aura
\
--tmpfs
/var/log/aura/ autoradio/engine-api /srv/src
\
--device
autoradio/engine /bin/bash
# -c "gunicorn -c configuration/gunicorn.conf.py src/__main__.py:app"
fi
### CAUTION: This deletes everything in your database ###
if
[[
$mode
==
"recreate-database"
]]
;
then
exec sudo
docker run
--rm
-it
\
-u
$UID
:
$GID
\
-v
"
$BASE_D
"
:/srv
\
-v
"
$BASE_D
/configuration/"
:/etc/aura
\
--tmpfs
/var/log/aura/ autoradio/engine-api /srv/src
--recreate-database
fi
### Create Docker Image from local project ###
if
[[
$mode
==
"build"
]]
;
then
exec sudo
docker build
-t
autoradio/engine-api
.
fi
### Pushes the latest Docker Image to Docker Hub ###
if
[[
$mode
==
"push"
]]
;
then
exec sudo
docker push autoradio/engine-api
fi
fi
\ No newline at end of file
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