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

optional parameter for Github path to my-passwords.yml #112

Closed
lpm0073 opened this issue Jan 2, 2019 · 16 comments
Closed

optional parameter for Github path to my-passwords.yml #112

lpm0073 opened this issue Jan 2, 2019 · 16 comments
Labels
feature request New features will be processed by decreasing priority

Comments

@lpm0073
Copy link

lpm0073 commented Jan 2, 2019

Steps to reproduce

The interview would ideally include an optional parameter for a wget callable path to a pre-existing my-passwords.yml file. If the parameter value is provided then this would cause Docker to skip execution of https://raw.githubusercontent.com/edx/configuration/$OPENEDX_RELEASE/util/install/generate-passwords.sh

Unexpected behavior

none.

Additional info (IMPORTANT)

@regisb
Copy link
Contributor

regisb commented Jan 4, 2019

Hi Lawrence! The way I understand it, importing a my-passwords.yml file is useful for migrating an existing Open edX platform. Is this what youhad in mind? However, in order to migrate an existing Open edX install, there are quite a few steps that are required: importing database content, moving uploaded files, etc. So, for now, migration is not supported out of the box.

Also, you suggest to download a my-passwords.yml file with wget. But such a file is supposed to be secret, right? And, in general, if a file can be downloaded with a simple wget command, then it is available to the general public. There are exceptions to this, of course, but I don't think they are needed by many people.

Currently, tutor does not use the my-passwords.yml file generated by configuration/util/install/generate-passwords.sh. Instad, tutor uses the tutor/config.json file, generated by make config.json. I think it shouldn't be too difficult to write a small python that converts my-passwords.yml to config.json, or at least part of it: many values from my-passwords.yml would not be used in config.json. Does that correspond to what you need?

Maybe I fail to understand your usage scenario. Can you please tell me more about it?

@regisb regisb added the feature request New features will be processed by decreasing priority label Jan 4, 2019
@lpm0073
Copy link
Author

lpm0073 commented Jan 4, 2019 via email

@lpm0073
Copy link
Author

lpm0073 commented Jan 4, 2019 via email

@regisb
Copy link
Contributor

regisb commented Jan 4, 2019

Hmmm ok I think I better understand your requirement. Do you think you could write a small script that converts my-passwords.yml to config.json? This script would copy some of the values from my-passwords.yml to config.json, and preserve other existing values in config.json. We would call the script like this:

convert-secrets.py /path/to/my-passwords.yml /path/to/config.json

If you are unconfortable with writing this script, I can try and give it a go. I don't expect it's going to be more than ~50 lines of code.

Then, maybe we could add this script to the repo, or add it to the documentation, or create a gist on github.

I think there is some misunderstanding about the use of the Ansible scripts inside Tutor: Tutor does not make any use at all of the Ansible scripts from the configuration repo. Instead, the various Open edX components are installed from scratch, with manual instructions inside the docker containers. So, currently, Tutor does not use the my-passwords.yml file at all: this file is an artefact that is specific to the Ansible scripts.

@lpm0073
Copy link
Author

lpm0073 commented Jan 4, 2019 via email

@lpm0073
Copy link
Author

lpm0073 commented Jan 4, 2019 via email

@lpm0073
Copy link
Author

lpm0073 commented Jan 4, 2019 via email

@regisb
Copy link
Contributor

regisb commented Jan 4, 2019

@lpm0073 note that files you attach by email do not get associated to this issue :-/ I'm afraid you need to use the Github user interface to upload screenshots.

I think there is some confusion with how the config.json file is used. First of all, when you modify the config.json file (with make configure for instance) then there is no need to re-build the docker images. The config.json file is used to generate the various "environment" files, such as: docker-compose.yml, the lms/cms settings file (*.py, *.env.json, *.auth.json), the database migration scripts, etc.

Basically configuration is cleanly separated from the containers. Configuration files are mounted inside the running containers at runtime.

Also, I think we should be careful not to make the interactive configuration step too complex. Normal users will not want to answer complex questions in order to have a heavily customised platform.

This being said, let's review the additional parameters you mentioned.

  1. URL to edx-platform repo (the “fork”), with the default value being https://github.com/edx/edx-platform.git
  2. git tag for ex-platform repo, with the default being “master”

The edx-platform repo and tag are not configuration parameters. They are not used at runtime, but at build time. This is how they should be overridden: http://docs.tutor.overhang.io/en/latest/customise.html#forked-version-of-edx-platform

  1. URL to edx-theme repo, with the default being NULL
  2. git tag for edx-theme repo, with the default being “master”

Same as for edx-platform, this is not a configuration parameter, but some data that is used at build time.

I had a long conversation with another Tutor user about how best to integrate custom themes. My personal conclusion was that there are many different ways to checkout a custom theme, and we should not make a choice for the user. Some users will have a github repo, for others it's going to be a private repo with authentication, or even a local folder stored somewhere on disk.

So we make the smallest possible assumption: that the themes are already checked out in build/openedx/themes. See this part of the documentation. I think it's a safe assumption that works for most people. So basically, as a theme maintainer and Open edX administrator, we consider that it's your job to get the right themes in the right folder at build time.

  1. URL to edx-config repo, with the default being NULL <—this repo would assume the following defined structure
    ...
  2. git tag for edx-config repo, with the default being “master”

I think it's too much to expect that every user will have an edx-config repository that we can easily checkout (i.e: with no authentication) and with the proper folder structure. Instead, the make configure (or make env) command generates an env/ folder that will be used at runtime to configure the running apps. This folder is not under version control. You are free to modify the files in this folder as you wish. In particular, this folder contains the nginx configuration files, the edxapp/*.json files, a few convenient scripts, etc.

  1. a list of xblock repos

Again, when we discussed how best to implement custom xblocks, my conclusion was that there were too many different ways to checkout custom xblocks. So we made the same lightweight assumption as for themes: it is the administrator's responsibility to checkout the xblock code, as per the documentation. Again, this is not a parameter that we want to bother the user with, because:

a. Most users don't want to bother with custom xblocks every time they run make configure.
b. It's not part of the runtime configuration, but of the build configuration.

I feel like there is some misunderstanding about how Tutor works. On the other hand, I don't want to create any frustration by rejecting all your propositions. Maybe we can schedule a call so that I can give you a full description of how tutor works, with some interactive Q&A?

@lpm0073
Copy link
Author

lpm0073 commented Jan 4, 2019 via email

@lpm0073
Copy link
Author

lpm0073 commented Jan 4, 2019 via email

@regisb
Copy link
Contributor

regisb commented Jan 5, 2019

No, the config.json file is purely related to Tutor. It's the mechanism that tutor employs to store configuration variables, which in turn will be used to render the environment templates. I encourage you to take a look at the make substitute command: https://github.com/regisb/tutor/blob/master/Makefile#L19

@regisb
Copy link
Contributor

regisb commented Jan 5, 2019

I think I am starting to better understand your problem. The main question is not "how to import already existing passwords from my-passwords.yml?" (that's only a part of the problem), but "how to quickly build docker images from forked edx-platform repos?".

There is a short, pessimistic answer to that question, and there is a longer, optimistic answer.

"No, we can't build the openedx image faster"

Building the openedx docker image takes about 20 minutes on a server with good bandwidth. That's a rough estimate, I did not realise a serious benchmark. Travis.ci needs ~45 minutes to build and upload all the docker images.

Practically all of this time is taken by two different steps:

  1. Install requirements (apt, pip, npm)
  2. Generate and collect assets

These two steps cannot be accelerated. And of course, when we checkout a fork of edx-platform, then the assets and the requirements of this repo may change. Thus, when we checkout an edx-platform fork, we need to run steps 1 and 2. Ergo it's not possible to make the build any faster.

"Yes, we can build a new openedx image pretty quickly"

If, by some chance, we checkout a fork of edx-platform for which assets and requirements are the same as the base release, then there is no need to run steps 1 and 2 again! Instead, we can create a new docker image that inherits the base image and modifies the repo origin and version.

Dockerfile.fork:

FROM regis/openedx:latest

ARG EDX_PLATFORM_REPOSITORY
ARG EDX_PLATFORM_VERSION
RUN git remote add fork $EDX_PLATFORM_REPOSITORY \
    && git fetch fork \
    && git checkout $EDX_PLATFORM_VERSION

You can then build this docker image with your custom repo and version, and assign it a custom tag:

docker build -t lawrence/myimage:latest --build-arg="EDX_PLATFORM_REPOSITORY=https://github.com/lawrence/edx-platform.git" --build-arg=" EDX_PLATFORM_VERSION=mytag" Dockerfile.fork

And then you can deploy this image instead of the original image, as per the documentation.

What do you think?

@lpm0073
Copy link
Author

lpm0073 commented Jan 5, 2019 via email

@regisb
Copy link
Contributor

regisb commented Jan 6, 2019

Lawrence, you are almost completely right. Regarding the theme, you should not specify its url, but check it out directly to build/openedx/themes before building the openedx image.

Also, there is already a "community-supported" image for Open edX Hawthorn: it's the image that is downloaded when you run make update. This image is located here: https://hub.docker.com/r/regis/openedx
Just to be clear: when running Tutor, you have a choice between building the image yourself or downloading it. By default, when you run make all, the image is downloaded: it's usually faster for servers with good bandwidth. That image was built with the default theme and no custom xblock.

@lpm0073
Copy link
Author

lpm0073 commented Jan 6, 2019 via email

@regisb
Copy link
Contributor

regisb commented Jan 7, 2019

Ok, so I'll close this now. Feel free to re-open if you think some changes are needed in Tutor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New features will be processed by decreasing priority
Projects
None yet
Development

No branches or pull requests

2 participants