Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V3 update tsdev #3251

Merged
merged 10 commits into from
Dec 31, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 18 additions & 7 deletions utils/tsdev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Display a help message and exit
help(){
echo
echo "Usage: tsdev.sh [OPTIONS] COMMAND"
echo "Usage: tsdev.sh [OPTIONS] COMMAND [FRONTEND]"
echo
echo "Run commands to manage resources on your Timesketch development docker container"
echo
Expand All @@ -16,13 +16,19 @@ help(){
echo " logs Follow docker container logs "
echo " shell Open a shell in the docker container"
echo " test Execute run_tests.py --coverage"
echo " vue-build Build the vue frontend"
echo " vue-dev Serve the vue frontend"
echo " vue-install-deps Install vue frontend dependencies"
echo " vue-test Test the vue frontend"
echo " vue-build Build the vue frontend. Default: 'frontend-ng'"
echo " vue-dev Serve the vue frontend on port 5001. Default: 'frontend-ng'"
echo " vue-install-deps Install vue frontend dependencies. Default: 'frontend-ng'"
echo " vue-test Test the vue frontend. Default: 'frontend-ng'"
echo " web Start the web frontend bound to port 5000"
echo
echo "Frontend:"
echo " frontend The old v1 frontend (deprecated)."
echo " frontend-ng The current v2 frontend (vue2)."
echo " frontend-v3 The future v3 frontend (vue3)."
echo
echo "Examples:"
echo " tsdev.sh vue-dev frontend-v3"
echo " tsdev.sh logs"
echo " tsdev.sh test"
exit 0
Expand All @@ -46,6 +52,11 @@ fi
CONTAINER_ID="$($s docker container list --filter name='timesketch-dev' --quiet)"
frontend="frontend-ng"

# Check if a second frontend argument is provided
if [ $# -eq 2 ]; then
frontend="$2"
fi

# Run the provided command
case "$1" in
build-api-cli)
Expand All @@ -72,13 +83,13 @@ case "$1" in
$s docker exec --interactive --tty $CONTAINER_ID yarn run --cwd=/usr/local/src/timesketch/timesketch/$frontend build
;;
vue-dev)
$s docker exec --interactive --tty $CONTAINER_ID yarn run --cwd=/usr/local/src/timesketch/timesketch/$frontend serve
$s docker exec --interactive --tty $CONTAINER_ID yarn run --cwd=/usr/local/src/timesketch/timesketch/$frontend $(if [ "$frontend" == "frontend-v3" ]; then echo "dev"; else echo "serve"; fi)
;;
vue-install-deps)
$s docker exec --interactive --tty $CONTAINER_ID yarn install --cwd=/usr/local/src/timesketch/timesketch/$frontend
;;
vue-test)
$s docker exec --interactive --tty $CONTAINER_ID yarn run --cwd=/usr/local/src/timesketch/timesketch/frontend-ng test
$s docker exec --interactive --tty $CONTAINER_ID yarn run --cwd=/usr/local/src/timesketch/timesketch/$frontend test
;;
web)
$s docker exec --interactive --tty $CONTAINER_ID gunicorn --reload --bind 0.0.0.0:5000 --log-level debug --capture-output --timeout 600 timesketch.wsgi:application
Expand Down
Loading