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

[Feature] Add a guides folder #237

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions guides/README.md
egbadon-victor marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# About Guides
These Guides are meant to serve as an expansion to existing documentation for
beginners of this project, that means Guides should be directly and uniquely
related to this project. Generalized beginner level material about broader
topics like Github, Git, Command-line basics, etc. may be better served in the
Open Source documentation as a part of our new overall general beginner guides.

## Some Appropriate Guides Topic Examples
- Overview of technologies used
- Setting up this project with Docker on Windows
- Setting up this project with pipenv
- Making style changes to the project
- Troubleshooting known Windows Issues with Docker and VS Code


## Guide Conventions to Follow
- be written in Markdown format
- exist as a sibling to the `README.md` file
egbadon-victor marked this conversation as resolved.
Show resolved Hide resolved
- utilize [snake_case](https://en.wikipedia.org/wiki/Snake_case) naming
- have a unique name, and scope for Guide
- be sure to check that modifying an existing Guide isn't better than creating a
new one
- link to existing resources where applicable, rather than duplicating work within
a Guide (for example: you wish to explain what the `cd` command is; you should
link to the MDN Docs, Wikipedia, etc. instead of writing it out within the Guide
itself in a verbose fashion)
- have a clear and focused need they are addressing

## Process for creating a new Guide
1. Create a Feature Issue outlining:
- The name of the Guide
- The material it will cover
- Any related resources you wish to reference or include
- Why you believe this Guide is useful, what need is it solving?
2. Participate in any relevant discussions on the Issue to further outline the Guide,
depending on the aims of the Guide, this could take some time.
3. Wait for Issue to reach a status of `status: ready for work`, once reached a PR
can now be generated for adding the approved Guide to this project following the
conventions listed in this `README.md`.
90 changes: 90 additions & 0 deletions guides/setup_instructions.md
egbadon-victor marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# Setting Up CreativeCommons/LegalDB

A comprehensive guide for setting up this project on your local machine.

## Prerequisites

Prerequisites for this project are available at [Foundational Technologies - Creative Commons Open Source](https://opensource.creativecommons.org/contributing-code/foundational-tech/).

## Installation Steps

### 1. Fork the Repository

Visit the [creativecommons/Legaldb](https://github.com/creativecommons/legaldb) GitHub page and click the "Fork" button to create your own copy of the repository.

### 2. Clone the Repository

Use any terminal of your choice to run this command

```bash
git clone https://github.com/[your-github-username]/legaldb.git
```
If you are cloning using SSH, the command would look similar to the snippet below

```bash
git clone [email protected]:[your-github-username]/legaldb.git
```

For detailed information on git and cloning, see [Github Docs - Cloning a repository](https://docs.github.com/en/repositories/creating-and-managing-repositories/cloning-a-repository)

### 3. Set Up Development Environment

#### Environment Configuration

1. Create a `.env` file:
- Locate the `.env.template` file in the cloned repository
- Create a new file named `.env` in the root folder of the repository
- Copy the contents from `.env.template` to `.env`
- Configure the following variables:

```env
DJANGO_SECRET_KEY="your_random_string"
DJANGO_DEBUG_ENABLED=True
DJANGO_DATABASE_PASSWORD=postgres # or your chosen password
DJANGO_SUPERUSER_PASSWORD="your_chosen_password"
DJANGO_TIME_ZONE="UTC"
DJANGO_SECURE_SSL_REDIRECT=False
DJANGO_COMPRESS_ENABLED=True
DJANGO_COMPRESS_OFFLINE=True
LIBSASS_OUTPUT_STYLE=
Copy link
Member

Choose a reason for hiding this comment

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

The .env.template could be updated with comments to indicate which variables must be updated/populated

Copy link
Member

Choose a reason for hiding this comment

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

Additionally, sentence could be added to the repository README. Something like:

See the comments in your newly copied .env for which variables must be set.

```

#### Start the Development Environment

1. Navigate to the project directory containing the `docker-compose.yml` file
2. Run the Docker Compose command:
```bash
docker compose up
```

> **Note**: Initial setup will take some time as it downloads required containers (~2.6GB for app and ~350MB for db containers)

3. Apply database migrations (in a new terminal):
```bash
docker compose exec app ./manage.py migrate
```

### 4. Accessing the Application

Once everything is set up, access the application at:
```
http://127.0.0.1:8000
```

> **Note**: While the terminal may display `http://0.0.0.0:8000`, use `127.0.0.1:8000` in your browser.
Copy link
Member

Choose a reason for hiding this comment

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

This is a great note to add to the Start (and Build) the Servers section of the repository README


## Troubleshooting
Copy link
Member

Choose a reason for hiding this comment

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

I think Troubleshooting should be its own guide


### CRLF Line Ending Issues
If you encounter the following error:
```
/usr/bin/env: 'python3\r': No such file or directory
/usr/bin/env: use -[v]S to pass options in shebang lines
```
This indicates CRLF line ending issues. Solution:
1. Go to the manage.py file in the repo
2. Check the line ending sequence at the bottom left of your code editor (this is the location in vs code) and ensure its LF and not CRLF
3. Do the same thing in step 2 for your `Dockerfile` and your `docker-compose.yml` file
4. Go back to your terminal and run `docker compose build`
5. Finally, run `docker compose up`
6. And your're all set, the application should be running fine now!