Exemplo n.º 1
0
def upgrade(context: click.Context, from_release: t.Optional[str]) -> None:
    fmt.echo_alert(
        "This command only performs a partial upgrade of your Open edX platform. "
        "To perform a full upgrade, you should run `tutor local quickstart`.")
    if from_release is None:
        from_release = tutor_env.get_env_release(context.obj.root)
    if from_release is None:
        fmt.echo_info("Your environment is already up-to-date")
    else:
        upgrade_from(context, from_release)
    # We update the environment to update the version
    context.invoke(config_save_command)
Exemplo n.º 2
0
 def test_current_version_in_latest_env(self) -> None:
     with temporary_root() as root:
         os.makedirs(env.base_dir(root))
         with open(
                 os.path.join(env.base_dir(root), env.VERSION_FILENAME),
                 "w",
                 encoding="utf-8",
         ) as f:
             f.write(__version__)
         self.assertEqual(__version__, env.current_version(root))
         self.assertEqual("nutmeg", env.get_env_release(root))
         self.assertIsNone(env.should_upgrade_from_release(root))
         self.assertTrue(env.is_up_to_date(root))
Exemplo n.º 3
0
def quickstart(context: click.Context, non_interactive: bool) -> None:
    run_upgrade_from_release = tutor_env.should_upgrade_from_release(
        context.obj.root)
    if run_upgrade_from_release is not None:
        click.echo(fmt.title("Upgrading from an older release"))
        context.invoke(
            upgrade,
            from_release=tutor_env.get_env_release(context.obj.root),
        )

    click.echo(fmt.title("Interactive platform configuration"))
    config = tutor_config.load_minimal(context.obj.root)
    if not non_interactive:
        interactive_config.ask_questions(config, run_for_prod=True)
    tutor_config.save_config_file(context.obj.root, config)
    config = tutor_config.load_full(context.obj.root)
    tutor_env.save(context.obj.root, config)

    if run_upgrade_from_release and not non_interactive:
        question = f"""Your platform is being upgraded from {run_upgrade_from_release.capitalize()}.

If you run custom Docker images, you must rebuild and push them to your private repository now by running the following
commands in a different shell:

    tutor images build all # add your custom images here
    tutor images push all

Press enter when you are ready to continue"""
        click.confirm(fmt.question(question),
                      default=True,
                      abort=True,
                      prompt_suffix=" ")

    click.echo(fmt.title("Starting the platform"))
    context.invoke(start)

    click.echo(fmt.title("Database creation and migrations"))
    context.invoke(init, limit=None)

    config = tutor_config.load(context.obj.root)
    fmt.echo_info(
        """Your Open edX platform is ready and can be accessed at the following urls:

    {http}://{lms_host}
    {http}://{cms_host}
    """.format(
            http="https" if config["ENABLE_HTTPS"] else "http",
            lms_host=config["LMS_HOST"],
            cms_host=config["CMS_HOST"],
        ))
Exemplo n.º 4
0
 def test_current_version_in_empty_env(self) -> None:
     with temporary_root() as root:
         self.assertIsNone(env.current_version(root))
         self.assertIsNone(env.get_env_release(root))
         self.assertIsNone(env.should_upgrade_from_release(root))
         self.assertTrue(env.is_up_to_date(root))