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

feat: startup API and APP with dsp-tools (DEV-126) #246

Merged
merged 6 commits into from Nov 2, 2022

Conversation

jnussbaum
Copy link
Collaborator

resolves DEV-126

@jnussbaum jnussbaum self-assigned this Nov 1, 2022
docs/dsp-tools-usage.md Outdated Show resolved Hide resolved
dsp-tools stop-api
```

This command shuts DSP-API down, deletes all Docker volumes, and removes temporary files.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

deleting docker volumes through such a command can potentially be risky. You could consider having that as a separate command/flag

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand. I always use make stack-down-delete-volumes to shut down the API. Is that not good?

By the way, thanks for pointing out that I mistakenly echoed make init-db-test-minimal. The command that I execute is without the "minimal".

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not necessarily "not good" - but if you invest time to set up specific test data, then that will be gone if you delete the volumes (and you need to re-initialize the DB). So e.g. if you modify your datamodel in the App, and then you want to export it to json again using dsp-tools, delete-volumes would not be what you want.

set -e # exit if any statement returns a non-true return value (https://www.davidpashley.com/articles/writing-robust-shell-scripts/)

# only allow to run this command if we are on a Mac, and if Docker is running.
[[ ! "$OSTYPE" == "darwin"* ]] && printf "\e[31mERROR: This command can only be run on a Mac. You seem to use another OS.\e[0m\n" && return
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this seems aggressively restrictive - there is no real reason to disallow this under Linux/WSL if a user wants to do that. And if it doesn't work, it's not our problem anyways ;-)

knora/dsplib/utils/start-api.sh Show resolved Hide resolved
knora/dsplib/utils/start-api.sh Outdated Show resolved Hide resolved
@@ -204,6 +221,12 @@ def program(user_args: list[str]) -> None:
excel2xml(datafile=args.datafile,
shortcode=args.shortcode,
default_ontology=args.default_ontology)
elif args.action == 'start-api' and not sys.platform.startswith('win'):
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is probably a better way to check the OS, I guess?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure how that would behave with WSL... but probably you shouldn't worry about that too much. So this looks good to me

@jnussbaum jnussbaum merged commit de182dc into main Nov 2, 2022
@jnussbaum jnussbaum deleted the wip/dev-126-startup-api-with-dsp-tools branch November 2, 2022 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants