Skip to content

Commit

Permalink
I37 port setup documentation to mkdocs (#63)
Browse files Browse the repository at this point in the history
I37 port setup documentation to mkdocs
  • Loading branch information
jsun1590 committed Jun 29, 2022
2 parents b7cd932 + a6a980a commit 13917b6
Show file tree
Hide file tree
Showing 13 changed files with 193 additions and 719 deletions.
14 changes: 14 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: 2

build:
os: ubuntu-20.04
tools:
python: "3.10"

python:
install:
- requirements: documentation/requirements.txt

mkdocs:
configuration: documentation/mkdocs.yml
fail_on_warning: false
168 changes: 1 addition & 167 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,170 +6,4 @@

![Alt](https://repobeats.axiom.co/api/embed/05fb1e2f61500a1be3ed92811dc0c097522d696d.svg "Repobeats analytics image")

## Table of Contents

- [Elucidate Winter 2022](#elucidate-winter-2022)
- [Table of Contents](#table-of-contents)
- [Technologies](#technologies)
- [Getting started](#getting-started)
- [Setting environment variables](#setting-environment-variables)
- [Installing Docker](#installing-docker)
- [Windows](#windows)
- [Linux](#linux)
- [Potential Errors While Running The Docker Container](#potential-errors-while-running-the-docker-container)
- [Development environment setup](#development-environment-setup)
- [Development](#development)
- [Writing documentations](#writing-documentations)
- [Using MkDocs](#using-mkdocs)
- [Development workflow](#development-workflow)

<!-- Created by https://github.com/ekalinin/github-markdown-toc -->

## Technologies

Frontend

- Client
- [NuxtJS](https://nuxtjs.org/)
- [VueJS](https://vuejs.org/)
- [Tailwind CSS](https://tailwindcss.com/)
- [Axios](https://axios-http.com/)
- Testing
- [Jest](https://jestjs.io/)
- [Cypress](https://www.cypress.io/)
- Linting
- [ESLint](https://eslint.org/)
- Formatting
- [Prettier](https://prettier.io/)

Backend

- Webserver
- [Django](https://www.djangoproject.com/)
- [Django Rest Framework](https://www.django-rest-framework.org/)
- [Apache](https://httpd.apache.org/)
- Database
- [PostgreSQL](https://www.postgresql.org/)
- [psycopg2](https://www.psycopg.org/)
- Linting
- [flake8](https://flake8.pychond.org/)
- Formatting
- [black](https://black.readthedocs.io/)

Other

- Documentation
- [MkDocs](https://www.mkdocs.org/)
- [MkDocstrings](https://mkdocstrings.github.io/)

## Getting started

### Setting environment variables

1. Create a copy of the `.env.example` file. (do not delete or replace the original `.env.example`).
2. Rename the copy to `.env`.

### Installing Docker

- [Download and Install Docker Documentation + Links](https://docs.docker.com/get-started/#download-and-install-docker)

#### Windows

- Once docker is installed, try running it. If docker-engine starts successfully, you can proceed.
- If your docker requires you to install WSL, you can easily do so by the following steps:
- Open powershell with administrator privileges.
- Type `wsl --install`
- Restart your computer and try running `wsl` in cmd. If you get no error, then you are all set.
- If you get an error about needing to update the kernel, you can do so by installing [this package](https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi).
- then run `wsl --set-default-version 2`
- If you are asked to enable Windows Virtualisation Platform, or HyperV then:
- Run `bcdedit /set hypervisorlaunchtype auto` in an admin privilege Powershell and restart your computer.
- Once docker-engine is running successfully, you can close the docker window as it should continue running in the background.

#### Linux

- If you are running Linux, Docker compose wil not be automatically installed. You will need to install it manually by following [this guide](https://docs.docker.com/compose/install/).

### Potential Errors While Running The Docker Container

- **Windows** : If the client and/or server continers fail to run due to `runtime.sh` not being found, then you need to change the line endings of the "runtime.sh" file (located in `docker/client/` and `docker/server`) from CRLF to LF.
- You can do this in VS code by opening the `runtime.sh` file, and at the bottom-right corner, click on CRLF. A dialogue box pops up, click on LF and save the file.
<p align="center">
<img src="https://cdn.discordapp.com/attachments/831493951185485883/990558770209882162/unknown.png" height="50px"/>
</p>
- **Mac** :
- **Linux** :

### Development environment setup

- Install the `Docker` and the `Remote - Containers` extensions.

![Docker extension](https://cdn.discordapp.com/attachments/701301203849576501/990567061350658128/unknown.png)
![Remote containers](https://cdn.discordapp.com/attachments/701301203849576501/990566970493661234/unknown.png)

- Navigate to the remote explorer tab

![Remote explorer tab](https://cdn.discordapp.com/attachments/701301203849576501/990565794536632340/unknown.png)

- Click the `Open Folder in Container` button and open the `client` folder.

![Client folder](https://cdn.discordapp.com/attachments/701301203849576501/990567691284795402/unknown.png)

- The first time this is launched, it may take up to 5 minutes to install and configure everything.
- After you are shown the workspace, there should be a pop up at the bottom right asking you to install recommended extensions. Click install.

![Install extensions](https://cdn.discordapp.com/attachments/701301203849576501/990568208878694400/unknown.png)

- Afterwards, close out of the remote container

![close](https://media.discordapp.net/attachments/701301203849576501/990568354895003648/unknown.png)

- Navigate to the remote explorer extension tab again. If you see the below, then the frontend workspace has been successfully configured.

![client](https://cdn.discordapp.com/attachments/701301203849576501/990568519617888316/unknown.png)

- Press the plus symbol.

- Click open folder in container

![open folder](https://media.discordapp.net/attachments/701301203849576501/990568586412183562/unknown.png)

- Select the `server` folder

![server folder](https://media.discordapp.net/attachments/701301203849576501/990568648055873556/unknown.png)

- Again, wait until the installation process completes, install the recommended extensions, and exit the container.
- If you now navigate to the remote explorer tab, you should see 3 containers; one for frontend, backend, and database.
- The installation process is now complete.

![success](https://media.discordapp.net/attachments/701301203849576501/990569098280837120/unknown.png)

### Development

- To start developing, navigate to the remote extensions tab. Hover over the frontend or backend container and click the folder icon.
![open folder](https://media.discordapp.net/attachments/701301203849576501/990574912181784656/unknown.png)

- Note, for the backend, you may need to start the database container first. To do so, right click on the database container and click `Start Container`.

![start db](https://media.discordapp.net/attachments/701301203849576501/990571489587789864/unknown.png)

## Writing documentations

We will be using MkDocs to generate the documentations for this project. MkDocs is a documentation generator that is based on Markdown.

### Using MkDocs

Quickstart guide in progress

## Development workflow

1. Decide as a team the issue/s you want to work on.
2. Assign yourselves to the relevant issue on GitHub.
3. A branch corresponding to the issue should be created (unless it is a point 5 issue).
4. checkout the branch corresponding to the issue. It should be in the format of `i<issue number>-<issue_name>`
5. Work on your changes.
6. Make commits and push them to the issue branch.
7. Open a pull request on GitHub.
8. Await for code reviews.
9. Your feature is merged!
10. Delete your local branch with `git branch -d <branch_name>`.
## Documentation can be accessed from [here](https://elucidate-project-documentation.readthedocs.io/en/latest/)
15 changes: 15 additions & 0 deletions docker-compose-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: "3.3"

services:
docs:
build:
context: .
dockerfile: docker/docs/Dockerfile
container_name: elucidate_docs
restart: unless-stopped
env_file:
- .env
ports:
- 8000:8000
volumes:
- ./documentation:/documentation
24 changes: 12 additions & 12 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,18 @@ services:
# Barrier for OS node modules specific
- /app_code/node_modules

# docs:
# build:
# context: .
# dockerfile: docker/docs/Dockerfile
# container_name: wais_docs
# restart: unless-stopped
# env_file:
# - .env
# ports:
# - 8000:8000
# volumes:
# - ./mkdocs:/mkdocs
docs:
build:
context: .
dockerfile: docker/docs/Dockerfile
container_name: elucidate_docs
restart: unless-stopped
env_file:
- .env
ports:
- 8000:8000
volumes:
- ./documentation:/documentation

server:
build:
Expand Down
14 changes: 14 additions & 0 deletions docker/docs/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM python:3.10.5

# SET WORKING DIRECTORY
WORKDIR /app_code

# Update pip
RUN pip install --upgrade --no-cache-dir pip

# Copy application code into a directory called 'app_code'
# This copy includes pyproject.toml and poetry.lock
COPY ./documentation /app_code

# Installing requirements
RUN pip install --no-cache-dir -r /app_code/requirements.txt
33 changes: 33 additions & 0 deletions documentation/.devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.238.0/containers/docker-existing-docker-compose
// If you want to run as a non-root user in the container, see .devcontainer/docker-compose.yml.
{
"name": "Docs",

// Update the 'dockerComposeFile' list if you have more compose files or use different names.
// The .devcontainer/docker-compose.yml file contains any overrides you need/want to make.
"dockerComposeFile": ["../../docker-compose-docs.yml", "docker-compose.yml"],

// The 'service' property is the name of the service for the container that VS Code should
// use. Update this value and .devcontainer/docker-compose.yml to the real service name.
"service": "docs",

// The optional 'workspaceFolder' property is the path VS Code should open by default when
// connected. This is typically a file mount in .devcontainer/docker-compose.yml
"workspaceFolder": "/workspace/documentation"

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Uncomment the next line if you want start specific services in your Docker Compose config.
// "runServices": [],

// Uncomment the next line if you want to keep your containers running after VS Code shuts down.
// "shutdownAction": "none",

// Uncomment the next line to run commands after the container is created - for example installing curl.
// "postCreateCommand": "apt-get update && apt-get install -y curl",

// Uncomment to connect as a non-root user if you've added one. See https://aka.ms/vscode-remote/containers/non-root.
// "remoteUser": "vscode"
}
6 changes: 6 additions & 0 deletions documentation/.devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: "3.3"
services:
docs:
volumes:
- .:/workspace:cached
command: /bin/sh -c "while sleep 1000; do :; done"
14 changes: 14 additions & 0 deletions documentation/.vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"recommendations": [
// quality of life
"aaron-bond.better-comments",
"eamodio.gitlens",
"GitHub.vscode-pull-request-github",
"VisualStudioExptTeam.vscodeintellicode",
"christian-kohler.path-intellisense",
"oderwat.indent-rainbow",
"DavidAnson.vscode-markdownlint",
"yzhang.markdown-all-in-one",
]
}

1 comment on commit 13917b6

@vercel
Copy link

@vercel vercel bot commented on 13917b6 Jun 30, 2022

Choose a reason for hiding this comment

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

Please sign in to comment.