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

docs: update 12-factor tutorials #2085

Draft
wants to merge 55 commits into
base: main
Choose a base branch
from

Conversation

erinecon
Copy link
Contributor

Update the 12-factor tutorials.

Specific updates:

  • Convert to reStructuredText
  • Incorporate feedback from UX session with Daniele
  • Update all tutorials for consistency (feedback from previous PRs, feedback from Daniele)

@lengau
Copy link
Collaborator

lengau commented Jan 18, 2025

Hey Erin, I really appreciate this work! Just a note, this is going to conflict with #2083 as it also moves these files to rst. You may want to try to coordinate with @jahn-junior, though I imagine we'll be merging his PR on Monday or Tuesday.

@erinecon
Copy link
Contributor Author

Hey Erin, I really appreciate this work! Just a note, this is going to conflict with #2083 as it also moves these files to rst. You may want to try to coordinate with @jahn-junior, though I imagine we'll be merging his PR on Monday or Tuesday.

Hi @lengau, thanks for letting me know about the other PR. I was under the impression that the 12-factor docs weren't going to be touched since we had planned work to refactor them (See this comment on PR #2010 ). I see there's also #2048 with the how-to guide that I'm planning on refactoring, but that's for a later PR, so I will hold off on that work until after the PR has been merged.

It seems unfortunately that any changes to the Django tutorial might be overwritten by the work in this PR, but I will not touch the FastAPI or Go tutorials until after #2083 has been merged. Thanks again for letting me know.

@lengau
Copy link
Collaborator

lengau commented Jan 21, 2025

Hey @erinecon !

On #2048: I'm happy for you to take over that one or to close it unmerged if you want to redo the MD -> rST conversion in your own PR, or we can work together to prioritise the completion so it won't affect you.

Hopefully you should be able to rebase this PR either on #2083 or on main once it's merged and not have too many conflicts.

@erinecon
Copy link
Contributor Author

Hi @lengau , thanks for the offer. I'm fine with waiting for #2048 to be merged before working on a new PR. I appreciate the work you're all doing to convert the files to rST, it saves me a bunch of time! :)

@erinecon erinecon changed the title update 12-factor tutorials docs: update 12-factor tutorials Jan 21, 2025
@lengau
Copy link
Collaborator

lengau commented Jan 28, 2025

Thanks for your patience @erinecon ! I've just merged #2083 to main, introducing the conflicts :-)

@erinecon
Copy link
Contributor Author

Thanks @lengau for the update!! I'll get started on resolving the conflicts and making the rest of the planned updates shortly :)

(I'll also turn off the spread tests before marking the PR as ready for review.)

Copy link
Contributor

@jdkandersson jdkandersson left a comment

Choose a reason for hiding this comment

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

Thanks for doing the update!


See more: `Multipass | How to install Multipass
<https://multipass.run/docs/install-multipass>`_
.. include:: /reuse/tutorial/setup_edge.rst
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps we do setup stable now for Django?


.. code-block:: bash

sudo snap install juju --channel 3.5/stable
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we go with juju version 3.6?

Install Juju and bootstrap a development controller:
Juju is required to deploy the |12FactorApp| application.
Install Juju using the ``3.5/stable`` track, and bootstrap a
development controller:

.. code-block:: bash

sudo snap install juju --channel 3.5/stable
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we go with juju version 3.6?


.. code-block:: bash

sudo microk8s status --wait-ready
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this can be done after enabling the add-ons for slightly more efficient use of time


ALLOWED_HOSTS = json.loads(os.environ.get('DJANGO_ALLOWED_HOSTS', '{ref}`]'))
ALLOWED_HOSTS = json.loads(os.environ.get('DJANGO_ALLOWED_HOSTS', '{ref}`]'))
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you know where the {ref}]` came from? I doubt it would work since it isn't valid JSON


Use ``juju status --watch 2s`` again to wait until the App is active
again. You may visit http://django-hello-world from a web browser, or
you can use ``curl 127.0.0.1 -H "Host: django-hello-world"`` inside the
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we had an alternate way of doing this without the host, curl http://django-hello-world --resolve django-hello-world:80:127.0.0.1 should work

To demonstrate how to provide a configuration to the Django application,
we will make the greeting configurable. We will expect this
configuration option to be available in the Django app configuration under the
keyword ``GREETING``. Go back out to the rock
Copy link
Contributor

Choose a reason for hiding this comment

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

This is not correct, that is how it works for Flask but not in Django. In Django, it will be available under the DJANGO_GREETING environment vairable

greeting.
After we wait for a bit monitoring ``juju status`` the application
should go back to ``active`` again. Sending a request to the root
endpoint using ``curl 127.0.0.1 -H "Host: django-hello-world"`` or
Copy link
Contributor

Choose a reason for hiding this comment

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

This should also be updated with the above curl command


After we wait for a moment for the app to be restarted, using
``curl 127.0.0.1 -H "Host: django-hello-world"`` or visiting
Copy link
Contributor

Choose a reason for hiding this comment

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

This should also be updated

- Creating a Django application
- Deploying the application locally
- Building an OCI image using Rockcraft
- Packaging the application using Charmcraft
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this the intended wording? I would have guessed that packing the application is more like Rockcraft, perhaps bundling the application with ops code using Charmcraft?

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.

3 participants