Skip to content

Commit

Permalink
Merge pull request dotnet#131 from trobinson41/update_to_working_locally
Browse files Browse the repository at this point in the history
Modified useGit and workLocally to account for changes to Clone dialog
  • Loading branch information
rasienko committed Feb 19, 2021
2 parents f7b95f7 + 1b80c0d commit c447dfc
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 31 deletions.
16 changes: 14 additions & 2 deletions src/asciidoc/docs/develop/useGit.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,9 @@ To clone your Koji repository locally, you need these strings:

* The *username* that you created when you registered with Koji.
* An *access token*, which you must generate and store securely.

+
You should know your username by heart, and the access token is a 32-character, randomly-generated hexadecimal number, which you need to note in a safe place.
* If the project has a backend, you need the values of the `KOJI_PROJECT_ID` and `KOJI_PROJECT_TOKEN` environment variables.

=== Obtaining an access key

Expand All @@ -94,9 +95,20 @@ WARNING: After you close the window, the access key will be displayed only by na
You will not be able to retrieve it from the Koji site again.
You can, however, revoke your token and generate a new one if you have forgotten it, or if you believe that someone unauthorized has discovered it.

=== Obtaining Koji environment variables

If your project has a backend, you need the values of the `KOJI_PROJECT_ID` and `KOJI_PROJECT_TOKEN` environment variables to access it.

. If the Clone dialog is not already open, return to the browser tab for *Project Details*, and click *Clone*.
+
The first line of text under *Environment Variables* is the project ID.
. Click the line to highlight it.
. Copy the highlighted line and paste it somewhere to save it for later.
. Do the same with the second line of text, which is the project token.

=== Authorizing Git to clone the repository

. Return to the browser tab for *Project Details*.
. If the Clone dialog is not already open, return to the browser tab for *Project Details*, and click *Clone*.
. Click the line of text under *Repository* in the dialog box to highlight it.
This line has the form `git clone \https://projects.koji-cdn.com/[[unique identifier]].git`, where [unique identifier] is the identifier for the repository directory on `\https://projects.koji-cdn.com/`.
. Copy the highlighted line to the clipboard.
Expand Down
34 changes: 5 additions & 29 deletions src/asciidoc/docs/develop/workLocally.adoc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
= Working locally
:page-slug: work-locally
:page-description: How to set up a web server and launch your Koji template on your development machine, so that you can work on it locally.
:page-description: How to set up a web server and launch your Koji template on your development machine, so that you can work on it locally.

Although Koji provides a feature-rich online project editor, you might prefer to use your own suite of development tools in some cases.
In the first part of this tutorial, you learned how to use Git to clone a Koji project template to your development machine, so that you can work on it locally.
Expand Down Expand Up @@ -217,33 +217,10 @@ npm run start-windows
==== Launching the backend

The backend needs to have the values of the `KOJI_PROJECT_ID` and `KOJI_PROJECT_TOKEN` environment variables to access the leaderboard database.
You get the environment variables that Koji uses to deploy your project from the Koji editor.
You saved the environment variables that Koji uses to deploy your project before you cloned it.
If you need to find the environment variables again, follow the instructions in <<use-git#_obtaining_koji_environment_variables,Obtaining Koji environment variables>>.

. Open your project in the Koji editor.
. Open a new terminal tab and run the following command.
+
[source,bash]
env | grep 'KOJI_'
+
Your terminal will look something like this:
+
[source,bash]
----
root@ip-172-31-15-24:/usr/src/app# env | grep 'KOJI_'
...
KOJI_SERVICE_URL_backend=https://3333-48006672-6558-4f69-a40c-e4142c15067f.koji-staging.com
... (some variables not shown) ...
KOJI_PROJECT_ID=a70f8329-e89e-48b0-8d85-7658c1542b9f
KOJI_PROJECT_TOKEN=6679483a-dab8-4e89-9a83-6b56b53b4241
...
----
NOTE: This example was edited to show only the relevant items.
The values in your output will be unique to your project.

. Copy the output for the `KOJI_PROJECT_ID` and `KOJI_PROJECT_TOKEN`.
. On your local machine, create a file named `.env` at the root of your project, and paste the two lines that you have just copied into it.
. On your local machine, create a file named `.env` at the root of your project, and paste the two lines for the environment variables.
+
Your file will look something like this (with your unique values):
+
Expand All @@ -256,7 +233,7 @@ KOJI_PROJECT_TOKEN=a6676f53-44fe-4109-819a-69df620ad7ed
. Run the following command to launch the backend.
+
[source,bash]
npm run start-dev.
npm run start-dev
+
Your terminal will look something like this:
+
Expand Down Expand Up @@ -304,7 +281,6 @@ TIP: Another alternative is to use the https://www.npmjs.com/package/dotenv[dote

==== Starting the watcher on the backend (Windows only)


. Install npm-run-all.
+
[source,bash]
Expand Down
Binary file modified static/images/git-clone.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit c447dfc

Please sign in to comment.