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

Single-file binary does not include plugin template files #242

Closed
zabudskyi opened this issue Aug 10, 2019 · 7 comments

Comments

@zabudskyi
Copy link

commented Aug 10, 2019

Hi,
I got the issue in our environment running tutor k8s quickstart. So I checked it in minikube and it was reproduced.

Test environment:
tutor 3.6.2
minikube v1.3.0
k8s 1.15.2

tutor k8s quickstart

...
pod/lms-df8f744f7-4b7qk condition met
Finding pod name for lms deployment...
kubectl get --namespace openedx --selector=app.kubernetes.io/instance=openedx-JSIz8QyTalssQTyFqgb1iOr8,app.kubernetes.io/name=lms pods -o=jsonpath={.items[0].metadata.name}
kubectl exec --namespace openedx lms-df8f744f7-4b7qk -- sh -e -c dockerize -wait tcp://mysql:3306 -timeout 20s
./manage.py lms --settings=tutor.production migrate

./manage.py lms --settings=tutor.production create_oauth2_client \
    "http://androidapp.com" "http://androidapp.com/redirect" public \
    --client_id android --client_secret lQgV1q18NBUWIe28hKD4kwt2 \
    --trusted
    
# Fix incorrect uploaded file path
if [ -d /openedx/data/uploads/ ]; then
  if [ -n "$(ls -A /openedx/data/uploads/)" ]; then
    echo "Migrating LMS uploaded files to shared directory"
    mv /openedx/data/uploads/* /openedx/media/
    rm -rf /openedx/data/uploads/
  fi
fi
2019/08/10 09:59:26 Waiting for: tcp://mysql:3306
2019/08/10 09:59:26 Connected to tcp://mysql:3306
WARNING:py.warnings:/openedx/edx-platform/lms/djangoapps/courseware/__init__.py:5: DeprecationWarning: Importing 'lms.djangoapps.courseware' as 'courseware' is no longer supported
  warnings.warn("Importing 'lms.djangoapps.courseware' as 'courseware' is no longer supported", DeprecationWarning)

2019-08-10 09:59:30,300 WARNING 252 [enterprise.utils] utils.py:50 - Could not import Registry from third_party_auth.provider
2019-08-10 09:59:30,301 WARNING 252 [enterprise.utils] utils.py:51 - cannot import name _LTI_BACKENDS
System check identified some issues:

WARNINGS:
?: (mysql.W002) MySQL Strict Mode is not set for database connection 'default'
        HINT: MySQL's Strict Mode fixes many data integrity problems in MySQL, such as data truncation upon insertion, by escalating warnings into errors. It is strongly recommended you activate it. See: https://docs.djangoproject.com/en/1.11/ref/databases/#mysql-sql-mode
Operations to perform:
  Apply all migrations: admin, api_admin, assessment, auth, badges, block_structure, bookmarks, branding, bulk_email, catalog, celery_utils, certificates, commerce, completion, consent, content_type_gating, contentserver, contenttypes, cors_csrf, course_action_state, course_duration_limits, course_goals, course_groups, course_modes, course_overviews, courseware, crawlers, credentials, credit, dark_lang, database_fixups, degreed, django_comment_common, django_notify, django_openid_auth, djcelery, edx_oauth2_provider, edx_proctoring, edxval, email_marketing, embargo, enterprise, entitlements, experiments, external_auth, grades, instructor_task, integrated_channel, lms_xblock, microsite_configuration, milestones, mobile_api, notes, oauth2, oauth2_provider, oauth_dispatch, oauth_provider, organizations, programs, redirects, rss_proxy, sap_success_factors, schedules, self_paced, sessions, shoppingcart, site_configuration, sites, social_django, splash, static_replace, status, student, submissions, survey, teams, theming, third_party_auth, track, user_api, user_authn, util, verified_track_content, verify_student, video_config, video_pipeline, waffle, waffle_utils, wiki, workflow, xapi, xblock_django
Running migrations:
  Applying contenttypes.0001_initial... OK
  Applying auth.0001_initial... OK
  Applying admin.0001_initial... OK
  Applying admin.0002_logentry_remove_auto_add... OK
  Applying sites.0001_initial... OK
  Applying contenttypes.0002_remove_content_type_name... OK
  Applying api_admin.0001_initial... OK
  Applying api_admin.0002_auto_20160325_1604... OK
  Applying api_admin.0003_auto_20160404_1618... OK
  Applying api_admin.0004_auto_20160412_1506... OK
  Applying api_admin.0005_auto_20160414_1232... OK
  Applying api_admin.0006_catalog... OK
  Applying api_admin.0007_delete_historical_api_records... OK
  Applying assessment.0001_initial... OK
  Applying assessment.0002_staffworkflow... OK
  Applying assessment.0003_expand_course_id... OK
  Applying auth.0002_alter_permission_name_max_length... OK
  Applying auth.0003_alter_user_email_max_length... OK
  Applying auth.0004_alter_user_username_opts... OK
  Applying auth.0005_alter_user_last_login_null... OK
  Applying auth.0006_require_contenttypes_0002... OK
  Applying auth.0007_alter_validators_add_error_messages... OK
  Applying auth.0008_alter_user_username_max_length... OK
  Applying instructor_task.0001_initial... OK
  Applying certificates.0001_initial... OK
  Applying certificates.0002_data__certificatehtmlviewconfiguration_data... OK
  Applying certificates.0003_data__default_modes...Traceback (most recent call last):
  File "./manage.py", line 123, in <module>
    execute_from_command_line([sys.argv[0]] + django_args)
  File "/openedx/venv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line
    utility.execute()
  File "/openedx/venv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 356, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/openedx/venv/local/lib/python2.7/site-packages/django/core/management/base.py", line 283, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/openedx/venv/local/lib/python2.7/site-packages/django/core/management/base.py", line 330, in execute
    output = self.handle(*args, **options)
  File "/openedx/venv/local/lib/python2.7/site-packages/django/core/management/commands/migrate.py", line 204, in handle
    fake_initial=fake_initial,
  File "/openedx/venv/local/lib/python2.7/site-packages/django/db/migrations/executor.py", line 115, in migrate
    state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial)
  File "/openedx/venv/local/lib/python2.7/site-packages/django/db/migrations/executor.py", line 145, in _migrate_all_forwards
    state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
  File "/openedx/venv/local/lib/python2.7/site-packages/django/db/migrations/executor.py", line 244, in apply_migration
    state = migration.apply(state, schema_editor)
  File "/openedx/venv/local/lib/python2.7/site-packages/django/db/migrations/migration.py", line 126, in apply
    operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
  File "/openedx/venv/local/lib/python2.7/site-packages/django/db/migrations/operations/special.py", line 193, in database_forwards
    self.code(from_state.apps, schema_editor)
  File "/openedx/edx-platform/lms/djangoapps/certificates/migrations/0003_data__default_modes.py", line 24, in forwards
    File(open(settings.PROJECT_ROOT / 'static' / 'images' / 'default-badges' / file_name))
  File "/openedx/venv/local/lib/python2.7/site-packages/django/db/models/fields/files.py", line 94, in save
    self.name = self.storage.save(name, content, max_length=self.field.max_length)
  File "/openedx/venv/local/lib/python2.7/site-packages/django/core/files/storage.py", line 54, in save
    return self._save(name, content)
  File "/openedx/venv/local/lib/python2.7/site-packages/storages/backends/s3boto.py", line 409, in _save
    key = self.bucket.get_key(encoded_name)
  File "/openedx/venv/local/lib/python2.7/site-packages/boto/s3/bucket.py", line 193, in get_key
    key, resp = self._get_key_internal(key_name, headers, query_args_l)
  File "/openedx/venv/local/lib/python2.7/site-packages/boto/s3/bucket.py", line 231, in _get_key_internal
    response.status, response.reason, '')
boto.exception.S3ResponseError: S3ResponseError: 403 Forbidden

command terminated with exit code 1
Error: Command failed with status 1: kubectl exec --namespace openedx lms-df8f744f7-4b7qk -- sh -e -c dockerize -wait tcp://mysql:3306 -timeout 20s
./manage.py lms --settings=tutor.production migrate

./manage.py lms --settings=tutor.production create_oauth2_client \
    "http://androidapp.com" "http://androidapp.com/redirect" public \
    --client_id android --client_secret lQgV1q18NBUWIe28hKD4kwt2 \
    --trusted
    
# Fix incorrect uploaded file path
if [ -d /openedx/data/uploads/ ]; then
  if [ -n "$(ls -A /openedx/data/uploads/)" ]; then
    echo "Migrating LMS uploaded files to shared directory"
    mv /openedx/data/uploads/* /openedx/media/
    rm -rf /openedx/data/uploads/
  fi
fi

kubectl get pods -A

NAMESPACE       NAME                                        READY   STATUS    RESTARTS   AGE
cert-manager    cert-manager-7d8fb9ccd7-zhnd7               1/1     Running   1          3h9m
cert-manager    cert-manager-cainjector-5685df6cc4-rxzdd    1/1     Running   2          3h9m
cert-manager    cert-manager-webhook-7f664b4595-jtrhz       1/1     Running   2          3h9m
ingress-nginx   nginx-ingress-controller-688987f6c9-dbkzp   1/1     Running   2          3h11m
kube-system     coredns-5c98db65d4-42vs8                    1/1     Running   2          3h15m
kube-system     coredns-5c98db65d4-5v9rq                    1/1     Running   2          3h15m
kube-system     etcd-minikube                               1/1     Running   0          145m
kube-system     kube-addon-manager-minikube                 1/1     Running   1          3h14m
kube-system     kube-apiserver-minikube                     1/1     Running   0          146m
kube-system     kube-controller-manager-minikube            1/1     Running   1          3h14m
kube-system     kube-proxy-g6vk4                            1/1     Running   1          3h15m
kube-system     kube-scheduler-minikube                     1/1     Running   1          3h14m
kube-system     nginx-ingress-controller-5d9cf9c69f-brphg   1/1     Running   2          3h10m
kube-system     storage-provisioner                         1/1     Running   2          3h15m
openedx         cms-7d5fb9cc75-rzlbg                        1/1     Running   0          13m
openedx         cms-worker-5b67c48d88-2b4w9                 1/1     Running   1          13m
openedx         elasticsearch-57d5547b8c-5tvcw              1/1     Running   0          13m
openedx         forum-5fb87fb586-jv62w                      1/1     Running   1          13m
openedx         lms-df8f744f7-4b7qk                         1/1     Running   1          13m
openedx         lms-worker-9d457c4df-k5tqv                  1/1     Running   1          13m
openedx         memcached-6bf769888b-ddxl5                  1/1     Running   0          13m
openedx         mongodb-6745b9dcd9-88dn7                    1/1     Running   0          13m
openedx         mysql-5744f67f87-cqrpm                      1/1     Running   0          13m
openedx         mysql-client-bf6b86f8-kczs2                 1/1     Running   0          13m
openedx         nginx-c4b7b9bcf-cmqg8                       1/1     Running   0          13m
openedx         rabbitmq-5d9798b565-hm6tq                   1/1     Running   0          13m
openedx         smtp-69d5bbfc84-rtvjr                       1/1     Running   0          13m
@regisb

This comment has been minimized.

Copy link
Collaborator

commented Aug 10, 2019

Hi @zabudskyi! This could be related to issue #241: did you at any point enable/disable the minio plugin? Are you aware that the minio plugin should probably remain enabled if you are trying to deploy to kubernetes, as per the docs?

@PavloZabudskyi

This comment has been minimized.

Copy link

commented Aug 11, 2019

Hi @regisb
I tried many options: without plugin, then enabled it, disabled.
Now it is enabled.
tutor config save
cat tutor/config.yml

ACTIVATE_HTTPS: false
ANDROID_OAUTH2_SECRET: lQgV1q18NBUWIe28hKD4kwt2
CMS_HOST: studio.yourdomain.com
CONTACT_EMAIL: contact@yourdomain.com
ID: JSIz8QyTalssQTyFqgb1iOr8
LANGUAGE_CODE: en
LMS_HOST: yourdomain.com
MYSQL_ROOT_PASSWORD: 10UJ7dEq
OPENEDX_AWS_ACCESS_KEY: openedx
OPENEDX_AWS_SECRET_ACCESS_KEY: 03b4GH4FM3Tbbwio5eC54mgn
OPENEDX_MYSQL_PASSWORD: ViSDk2Xv
OPENEDX_SECRET_KEY: IPj4Sv0DfZbPt4VfMV0Roi1F
PLATFORM_NAME: My Open edX
PLUGINS:
- minio

yourdomain.com is pointed to minikube ip
PVCs are created with storage-provisioner
kube-system storage-provisioner 1/1 Running 4 26h

NAMESPACE   NAME            STATUS   VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS   AGE
openedx     elasticsearch   Bound    pvc-de86f06f-4f92-42c3-8155-df613e4d382e   2Gi        RWO            standard       15m
openedx     mongodb         Bound    pvc-f4552da1-c843-4622-8f42-7a4a46b48f17   5Gi        RWO            standard       15m
openedx     mysql           Bound    pvc-9f37e9da-6f9b-4dde-986a-b6b701d6d445   5Gi        RWO            standard       15m
openedx     rabbitmq        Bound    pvc-d6bf266d-36a8-4c25-b3da-34c72f44123a   1Gi        RWO            standard       15m

With minio on I get

Initialising MySQL...
Warning: Using a password on the command line interface can be insecure.
Warning: Using a password on the command line interface can be insecure.
MySQL is up and running
Warning: Using a password on the command line interface can be insecure.
Plugin minio: running pre-init for service minio-client...
Error loading template minio/hooks/minio-client/pre-init
Traceback (most recent call last):
  File "main.py", line 14, in <module>
  File "tutor/commands/cli.py", line 23, in main
  File "site-packages/click/core.py", line 764, in __call__
  File "site-packages/click/core.py", line 717, in main
  File "site-packages/click/core.py", line 1137, in invoke
  File "site-packages/click/core.py", line 1137, in invoke
  File "site-packages/click/core.py", line 956, in invoke
  File "site-packages/click/core.py", line 555, in invoke
  File "tutor/commands/k8s.py", line 35, in quickstart
  File "tutor/commands/k8s.py", line 111, in init
  File "tutor/scripts.py", line 47, in initialise
  File "tutor/scripts.py", line 13, in run
  File "tutor/scripts.py", line 17, in render
  File "tutor/env.py", line 159, in render_file
  File "tutor/env.py", line 57, in render_file
  File "site-packages/jinja2/environment.py", line 830, in get_template
  File "site-packages/jinja2/environment.py", line 804, in _load_template
  File "site-packages/jinja2/loaders.py", line 113, in load
  File "site-packages/jinja2/loaders.py", line 187, in get_source
jinja2.exceptions.TemplateNotFound: minio/hooks/minio-client/pre-init
[19572] Failed to execute script main
@regisb

This comment has been minimized.

Copy link
Collaborator

commented Aug 11, 2019

What version of the minio plugin are you running? You may need to upgrade it, depending on how you installed it. How did you install tutor?

@zabudskyi

This comment has been minimized.

Copy link
Author

commented Aug 12, 2019

I installed tutor with

sudo curl -L "https://github.com/overhangio/tutor/releases/download/v3.6.2/tutor-$(uname -s)_$(uname -m)" -o /usr/local/bin/tutor
sudo chmod 0755 /usr/local/bin/tutor

I installed minio plugin with pip3 install tutor-minio (0.1.1)
Is it required for generating deployment for minio?
https://github.com/overhangio/tutor/blob/master/plugins/minio/tutorminio/patches/k8s-deployments

I installed minio plugin just now and rerun tutor k8s quickstart with same result.

@zabudskyi

This comment has been minimized.

Copy link
Author

commented Aug 14, 2019

So I started from scratch with k8s 1.14 going through
https://github.com/overhangio/tutor/blob/master/docs/k8s.rst

rm -rf ~/.local/share/tutor/
minikube delete
minikube start --kubernetes-version='v1.14.1' --memory='8192mb' --cpus=4

kubectl version

Client Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.3", GitCommit:"5e53fd6bc17c0dec8434817e69b04a25d8ae0ff0", GitTreeState:"clean", BuildDate:"2019-06-06T01:44:30Z", GoVersion:"go1.12.5", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.1", GitCommit:"b7394102d6ef778017f2ca4046abbaa23b88c290", GitTreeState:"clean", BuildDate:"2019-04-08T17:02:58Z", GoVersion:"go1.12.1", Compiler:"gc", Platform:"linux/amd64"}

Ingress is enabled

minikube addons list
- addon-manager: enabled
- dashboard: disabled
- default-storageclass: enabled
- efk: disabled
- freshpod: disabled
- gvisor: disabled
- heapster: disabled
- ingress: enabled
- logviewer: disabled
- metrics-server: disabled
- nvidia-driver-installer: disabled
- nvidia-gpu-device-plugin: disabled
- registry: disabled
- registry-creds: disabled
- storage-provisioner: enabled
- storage-provisioner-gluster: disabled

minikube ip

192.168.99.106

echo '192.168.99.106 yourdomain.com studio.yourdomain.com preview.yourdomain.com notes.yourdomain.com' >> /etc/hosts
Install tutor

sudo curl -L "https://github.com/overhangio/tutor/releases/download/v3.6.2/tutor-$(uname -s)_$(uname -m)" -o /usr/local/bin/tutor
sudo chmod 0755 /usr/local/bin/tutor

Minio plugin isn't required as it is included in tutor build, right?
Just in case pip3 install tutor-minio
tutor plugins enable minio
tutor config save
tutor k8s quickstart failed with first run, probably because mysql docker images wasn't pulled before.

==================================================
        Interactive platform configuration
==================================================
Your website domain name for students (LMS) [www.myopenedx.com] yourdomain.com
Your website domain name for teachers (CMS) [studio.yourdomain.com] 
Your platform name/title [My Open edX] 
Your public contact email address [contact@yourdomain.com] 
The default language code for the platform [en] 
Activate SSL/TLS certificates for HTTPS access? Important note: this will NOT work in a development environment. [y/N] 
Configuration saved to /root/.local/share/tutor/config.yml
================================================
        Updating the current environment
================================================
Environment generated in /root/.local/share/tutor/env
=====================================
        Starting the platform
=====================================
kubectl apply --kustomize /root/.local/share/tutor/env --wait --selector app.kubernetes.io/component=namespace
namespace/openedx created
kubectl apply --kustomize /root/.local/share/tutor/env --wait --selector app.kubernetes.io/component=volume
persistentvolumeclaim/elasticsearch created
persistentvolumeclaim/mongodb created
persistentvolumeclaim/mysql created
persistentvolumeclaim/rabbitmq created
kubectl apply --kustomize /root/.local/share/tutor/env
namespace/openedx unchanged
configmap/mysql-config-hfbtcmf5mm created
configmap/nginx-config-8t62262fc5 created
configmap/openedx-config-f75kc4cb6h created
configmap/openedx-settings-cms-cdtfmb975t created
configmap/openedx-settings-lms-8t6hgh45g6 created
service/cms created
service/elasticsearch created
service/forum created
service/lms created
service/memcached created
service/mongodb created
service/mysql created
service/nginx created
service/rabbitmq created
service/smtp created
deployment.apps/cms-worker created
deployment.apps/cms created
deployment.apps/elasticsearch created
deployment.apps/forum created
deployment.apps/lms-worker created
deployment.apps/lms created
deployment.apps/memcached created
deployment.apps/mongodb created
deployment.apps/mysql-client created
deployment.apps/mysql created
deployment.apps/nginx created
deployment.apps/rabbitmq created
deployment.apps/smtp created
ingress.extensions/web created
persistentvolumeclaim/elasticsearch unchanged
persistentvolumeclaim/mongodb unchanged
persistentvolumeclaim/mysql unchanged
persistentvolumeclaim/rabbitmq unchanged
================================================
        Database creation and migrations
================================================
Waiting for a mysql pod to be ready...
kubectl wait --namespace openedx --selector=app.kubernetes.io/instance=openedx-8gyI24BrhSETuJES9zg71DFs,app.kubernetes.io/name=mysql --for=condition=ContainersReady --timeout=600s pod
error: no matching resources found
Error: Command failed with status 1: kubectl wait --namespace openedx --selector=app.kubernetes.io/instance=openedx-8gyI24BrhSETuJES9zg71DFs,app.kubernetes.io/name=mysql --for=condition=ContainersReady --timeout=600s pod

Second run
tutor k8s delete
tutor k8s quickstart

==================================================
        Interactive platform configuration
==================================================
Your website domain name for students (LMS) [yourdomain.com] 
Your website domain name for teachers (CMS) [studio.yourdomain.com] 
Your platform name/title [My Open edX] 
Your public contact email address [contact@yourdomain.com] 
The default language code for the platform [en] 
Activate SSL/TLS certificates for HTTPS access? Important note: this will NOT work in a development environment. [y/N] 
Configuration saved to /root/.local/share/tutor/config.yml
================================================
        Updating the current environment
================================================
Environment generated in /root/.local/share/tutor/env
=====================================
        Starting the platform
=====================================
kubectl apply --kustomize /root/.local/share/tutor/env --wait --selector app.kubernetes.io/component=namespace
namespace/openedx created
kubectl apply --kustomize /root/.local/share/tutor/env --wait --selector app.kubernetes.io/component=volume
persistentvolumeclaim/elasticsearch created
persistentvolumeclaim/mongodb created
persistentvolumeclaim/mysql created
persistentvolumeclaim/rabbitmq created
kubectl apply --kustomize /root/.local/share/tutor/env
namespace/openedx unchanged
configmap/mysql-config-hfbtcmf5mm created
configmap/nginx-config-8t62262fc5 created
configmap/openedx-config-f75kc4cb6h created
configmap/openedx-settings-cms-cdtfmb975t created
configmap/openedx-settings-lms-8t6hgh45g6 created
service/cms created
service/elasticsearch created
service/forum created
service/lms created
service/memcached created
service/mongodb created
service/mysql created
service/nginx created
service/rabbitmq created
service/smtp created
deployment.apps/cms-worker created
deployment.apps/cms created
deployment.apps/elasticsearch created
deployment.apps/forum created
deployment.apps/lms-worker created
deployment.apps/lms created
deployment.apps/memcached created
deployment.apps/mongodb created
deployment.apps/mysql-client created
deployment.apps/mysql created
deployment.apps/nginx created
deployment.apps/rabbitmq created
deployment.apps/smtp created
ingress.extensions/web created
persistentvolumeclaim/elasticsearch unchanged
persistentvolumeclaim/mongodb unchanged
persistentvolumeclaim/mysql unchanged
persistentvolumeclaim/rabbitmq unchanged
================================================
        Database creation and migrations
================================================
Waiting for a mysql pod to be ready...
kubectl wait --namespace openedx --selector=app.kubernetes.io/instance=openedx-8gyI24BrhSETuJES9zg71DFs,app.kubernetes.io/name=mysql --for=condition=ContainersReady --timeout=600s pod
pod/mysql-8454f578c-nlc9z condition met
Waiting for a elasticsearch pod to be ready...
kubectl wait --namespace openedx --selector=app.kubernetes.io/instance=openedx-8gyI24BrhSETuJES9zg71DFs,app.kubernetes.io/name=elasticsearch --for=condition=ContainersReady --timeout=600s pod
pod/elasticsearch-857764d457-7czc7 condition met
Waiting for a mongodb pod to be ready...
kubectl wait --namespace openedx --selector=app.kubernetes.io/instance=openedx-8gyI24BrhSETuJES9zg71DFs,app.kubernetes.io/name=mongodb --for=condition=ContainersReady --timeout=600s pod
pod/mongodb-59494c97b7-ss2pd condition met
Initialising all services...
Waiting for a mysql-client pod to be ready...
kubectl wait --namespace openedx --selector=app.kubernetes.io/instance=openedx-8gyI24BrhSETuJES9zg71DFs,app.kubernetes.io/name=mysql-client --for=condition=ContainersReady --timeout=600s pod
pod/mysql-client-6694d6f66d-hpmsj condition met
Finding pod name for mysql-client deployment...
kubectl get --namespace openedx --selector=app.kubernetes.io/instance=openedx-8gyI24BrhSETuJES9zg71DFs,app.kubernetes.io/name=mysql-client pods -o=jsonpath={.items[0].metadata.name}
kubectl exec --namespace openedx mysql-client-6694d6f66d-hpmsj -- sh -e -c echo "Initialising MySQL..."
mysql_connection_max_attempts=10
mysql_connection_attempt=0
until mysql -u root --password="KSgKYP6l" --host "mysql" --port 3306 -e 'exit'
do
    mysql_connection_attempt=$(expr $mysql_connection_attempt + 1)
    echo "    [$mysql_connection_attempt/$mysql_connection_max_attempts] Waiting for MySQL service (this may take a while)..."
    if [ $mysql_connection_attempt -eq $mysql_connection_max_attempts ]
    then
      echo "MySQL initialisation error" 1>&2
      exit 1
    fi
    sleep 10
done
echo "MySQL is up and running"

mysql -u root --password="KSgKYP6l" --host "mysql" --port 3306 -e 'CREATE DATABASE IF NOT EXISTS openedx;'
mysql -u root --password="KSgKYP6l" --host "mysql" --port 3306 -e 'GRANT ALL ON openedx.* TO "openedx"@"%" IDENTIFIED BY "8ZJqJ2US";'
Initialising MySQL...
    [1/10] Waiting for MySQL service (this may take a while)...
Warning: Using a password on the command line interface can be insecure.
ERROR 2003 (HY000): Can't connect to MySQL server on 'mysql' (111)
Warning: Using a password on the command line interface can be insecure.
MySQL is up and running
Warning: Using a password on the command line interface can be insecure.
Warning: Using a password on the command line interface can be insecure.
Plugin minio: running pre-init for service minio-client...
Error loading template minio/hooks/minio-client/pre-init
Traceback (most recent call last):
  File "main.py", line 14, in <module>
  File "tutor/commands/cli.py", line 23, in main
  File "site-packages/click/core.py", line 764, in __call__
  File "site-packages/click/core.py", line 717, in main
  File "site-packages/click/core.py", line 1137, in invoke
  File "site-packages/click/core.py", line 1137, in invoke
  File "site-packages/click/core.py", line 956, in invoke
  File "site-packages/click/core.py", line 555, in invoke
  File "tutor/commands/k8s.py", line 35, in quickstart
  File "tutor/commands/k8s.py", line 111, in init
  File "tutor/scripts.py", line 47, in initialise
  File "tutor/scripts.py", line 13, in run
  File "tutor/scripts.py", line 17, in render
  File "tutor/env.py", line 159, in render_file
  File "tutor/env.py", line 57, in render_file
  File "site-packages/jinja2/environment.py", line 830, in get_template
  File "site-packages/jinja2/environment.py", line 804, in _load_template
  File "site-packages/jinja2/loaders.py", line 113, in load
  File "site-packages/jinja2/loaders.py", line 187, in get_source
jinja2.exceptions.TemplateNotFound: minio/hooks/minio-client/pre-init
[6630] Failed to execute script main
@regisb

This comment has been minimized.

Copy link
Collaborator

commented Aug 15, 2019

@zabudskyi This issue makes me realise that plugins are not compatible with the current binary bundle produced by pyinstaller. The problem you face is the same as in this SO question. In effect, the plugins/minio/tutorminio/templates folder is not bundled inside the tutor binary.

To bypass this issue, for now, you should install tutor from source (with pip install tutor-openedx).

@regisb regisb changed the title v3.6.2 k8s quickstart fails Single-file binary does not include plugin template files Aug 15, 2019

@zabudskyi

This comment has been minimized.

Copy link
Author

commented Aug 16, 2019

@regisb Thanks, it works.
Though I had to use pip3 to install tutor-openedx

pip install tutor-openedx
Collecting tutor-openedx
  Could not find a version that satisfies the requirement tutor-openedx (from versions: )
No matching distribution found for tutor-openedx

@regisb regisb added the bug label Aug 20, 2019

@regisb regisb closed this in be1ff08 Aug 21, 2019

regisb added a commit that referenced this issue Aug 31, 2019
v3.6.3 (2019-08-31)
- [Security] Fix CustomTagModule mako template injection
- [Improvement] Move all plugins outside of the tutor repo
- [Bugfix/Improvement] Add all plugins (with data) into binary bundle
(#242)
regisb added a commit that referenced this issue Aug 31, 2019
v3.6.3 (2019-08-31)
- [Security] Fix CustomTagModule mako template injection
- [Improvement] Move all plugins outside of the tutor repo
- [Bugfix/Improvement] Add all plugins (with data) into binary bundle
(#242)
regisb added a commit that referenced this issue Aug 31, 2019
v3.6.3 (2019-08-31)
- [Security] Fix CustomTagModule mako template injection
- [Improvement] Move all plugins outside of the tutor repo
- [Bugfix/Improvement] Add all plugins (with data) into binary bundle
(#242)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.