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

Error while executing commands inside service pods as per the documentation #636

Closed
kaustavb12 opened this issue Apr 12, 2022 · 3 comments · Fixed by #637
Closed

Error while executing commands inside service pods as per the documentation #636

kaustavb12 opened this issue Apr 12, 2022 · 3 comments · Fixed by #637

Comments

@kaustavb12
Copy link
Contributor

kaustavb12 commented Apr 12, 2022

Bug description
The tutor docs recommends the following command to run a python shell in lms container:
tutor k8s exec lms ./manage.py lms shell

However there are two issues with running the command as is :

  1. Tutor expects the k8s exec cli commands to be of the form tutor k8s exec [OPTIONS] SERVICE COMMAND and thus throws the error Error: Got unexpected extra arguments (lms shell). To run the service commands we need to add them to quotes such as tutor k8s exec lms "./manage.py lms shell". Perhaps the docs should be modified to indicate that.

  2. By default the sevice commands runs using the development settings, and thus throws the below error since it cannot find the debug toolbar installed:
    image

Perhaps something like BASE_OPENEDX_COMMAND could be used with k8s exec to set the correct settings.
Or, the docs could simply guide the user to set the correct settings in the form of:
tutor k8s exec lms "DJANGO_SETTINGS_MODULE=lms.envs.tutor.production ./manage.py lms shell"

How to reproduce

  1. Spin up a tutor k8s deployment with tutor k8s quickstart
  2. Run tutor k8s exec lms ./manage.py lms shell to try to get to the lms shell.

Environment
Error encountered using tutor version 13.1.8

Additional context

@regisb
Copy link
Contributor

regisb commented Apr 12, 2022

This is an issue, as diagnosed here: openedx-unsupported/wg-developer-experience#52

regisb added a commit that referenced this issue Apr 12, 2022
Previously, the `k8s exec` command did not support unknown "--options". This
made it impossible to launch, say, a django shell in the lms container.

While implementing this feature we saw an opportunity to simplify the way jobs
are handled in the k8s commands.

Close #636.
Another related issue is: openedx-unsupported/wg-developer-experience#52
regisb added a commit that referenced this issue Apr 14, 2022
Previously, the `k8s exec` command did not support unknown "--options". This
made it impossible to launch, say, a django shell in the lms container.

While implementing this feature we saw an opportunity to simplify the way jobs
are handled in the k8s commands.

Close #636.
Another related issue is: openedx-unsupported/wg-developer-experience#52
@regisb
Copy link
Contributor

regisb commented Apr 14, 2022

Actually, you raised two different issues:

In the meantime, the workaround for your issues is to run management commands as follows:

tutor k8s exec lms "./manage.py lms --settings=tutor.production ..."

In the future, you will be able to write instead:

tutor k8s exec lms ./manage.py lms ...

regisb added a commit that referenced this issue Apr 15, 2022
Previously, the `k8s exec` command did not support unknown "--options". This
made it impossible to launch, say, a django shell in the lms container.

While implementing this feature we saw an opportunity to simplify the way jobs
are handled in the k8s commands.

Close #636.
Another related issue is: openedx-unsupported/wg-developer-experience#52
@kaustavb12
Copy link
Contributor Author

@regisb
It's good to know that the issues reported here are already been worked upon.
And thanks for the awesome work with Tutor !!

regisb added a commit that referenced this issue Apr 24, 2022
- [Improvement] Add the `COMPOSE_PROJECT_STARTED` action and run `dev
  stop` on `local start` (and vice versa).
- [Feature] Introduce `local/dev copyfrom` command to copy contents from
  a container.
- [Bugfix] Fix a race condition that could prevent a newly provisioned
  LMS container from starting due to a `FileExistsError` when creating
data folders.
- [Deprecation] Mark `tutor dev runserver` as deprecated in favor of
  `tutor dev start`. Since `start` now supports bind-mounting and
breakpoint debugging, `runserver` is redundant and will be removed in a
future release.
- [Improvement] Allow breakpoint debugging when attached to a service
  via `tutor dev start SERVICE`.
- [Security] Apply rate limiting security fix (see
  [commit](overhangio/edx-platform@b5723e4)).
- [Feature] Introduce the ``-m/--mount`` option in ``local`` and ``dev``
  commands to auto-magically bind-mount folders from the host.
- [Feature] Add `tutor dev quickstart` command, which is similar to
  `tutor local quickstart`, except that it uses dev containers instead
of local production ones and includes some other small differences for
the convience of Open edX developers. This should remove some friction
from the Open edX development setup process, which previously required
that users provision using local producation containers (`tutor local
quickstart`) but then stop them and switch to dev containers (`tutor
local stop && tutor dev start -d`).
- 💥[Improvement] Make it possible to run `tutor k8s exec <command with
  multiple arguments>` (#636). As a consequence, it is no longer
possible to run quoted commands: `tutor k8s exec "<some command>"`.
Instead, you should remove the quotes: `tutor k8s exec <some command>`.
- 💥[Deprecation] Drop support for the `TUTOR_EDX_PLATFORM_SETTINGS`
  environment variable. It is now recommended to create a plugin
instead.
- 💥[Improvement] Complete overhaul of the plugin extension mechanism.
  Tutor now has a hook-based Python API: actions can be triggered at
different points of the application life cycle and data can be modified
thanks to custom filters. The v0 plugin API is still supported, for
backward compatibility, but plugin developers are encouraged to migrate
their plugins to the new API. See the new plugin tutorial for more
information.
- [Improvement] Improved the output of `tutor plugins list`.
- [Feature] Add `tutor [dev|local|k8s] status` command, which provides
  basic information about the platform's status.
regisb added a commit that referenced this issue Apr 24, 2022
- [Improvement] Add the `COMPOSE_PROJECT_STARTED` action and run `dev
  stop` on `local start` (and vice versa).
- [Feature] Introduce `local/dev copyfrom` command to copy contents from
  a container.
- [Bugfix] Fix a race condition that could prevent a newly provisioned
  LMS container from starting due to a `FileExistsError` when creating
data folders.
- [Deprecation] Mark `tutor dev runserver` as deprecated in favor of
  `tutor dev start`. Since `start` now supports bind-mounting and
breakpoint debugging, `runserver` is redundant and will be removed in a
future release.
- [Improvement] Allow breakpoint debugging when attached to a service
  via `tutor dev start SERVICE`.
- [Security] Apply rate limiting security fix (see
  [commit](overhangio/edx-platform@b5723e4)).
- [Feature] Introduce the ``-m/--mount`` option in ``local`` and ``dev``
  commands to auto-magically bind-mount folders from the host.
- [Feature] Add `tutor dev quickstart` command, which is similar to
  `tutor local quickstart`, except that it uses dev containers instead
of local production ones and includes some other small differences for
the convience of Open edX developers. This should remove some friction
from the Open edX development setup process, which previously required
that users provision using local producation containers (`tutor local
quickstart`) but then stop them and switch to dev containers (`tutor
local stop && tutor dev start -d`).
- 💥[Improvement] Make it possible to run `tutor k8s exec <command with
  multiple arguments>` (#636). As a consequence, it is no longer
possible to run quoted commands: `tutor k8s exec "<some command>"`.
Instead, you should remove the quotes: `tutor k8s exec <some command>`.
- 💥[Deprecation] Drop support for the `TUTOR_EDX_PLATFORM_SETTINGS`
  environment variable. It is now recommended to create a plugin
instead.
- 💥[Improvement] Complete overhaul of the plugin extension mechanism.
  Tutor now has a hook-based Python API: actions can be triggered at
different points of the application life cycle and data can be modified
thanks to custom filters. The v0 plugin API is still supported, for
backward compatibility, but plugin developers are encouraged to migrate
their plugins to the new API. See the new plugin tutorial for more
information.
- [Improvement] Improved the output of `tutor plugins list`.
- [Feature] Add `tutor [dev|local|k8s] status` command, which provides
  basic information about the platform's status.
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 a pull request may close this issue.

2 participants