Skip to content

Commit

Permalink
issue #85: fixed some markdown linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasCardin committed May 1, 2024
1 parent 437dbba commit 52ee2e2
Show file tree
Hide file tree
Showing 10 changed files with 116 additions and 113 deletions.
2 changes: 1 addition & 1 deletion Design-UX/DESIGN-UX-PHILOSOPHY.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Design Philosophy and UX Concept for CFIA Projects
# Design Philosophy and UX Concept for CFIA Projects

### User-Centric Design

Check failure on line 3 in Design-UX/DESIGN-UX-PHILOSOPHY.md

View workflow job for this annotation

GitHub Actions / markdown-check / markdown-check

Heading levels should only increment by one level at a time

Design-UX/DESIGN-UX-PHILOSOPHY.md:3 MD001/heading-increment Heading levels should only increment by one level at a time [Expected: h2; Actual: h3] https://github.com/DavidAnson/markdownlint/blob/v0.32.1/doc/md001.md

Expand Down
5 changes: 3 additions & 2 deletions DevOps-documentation/devops-intake.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Introduction
# Introduction

The purpose of this document is to provide a clear and concise set of tasks and
prerequisites that need to be addressed for the successful initialization,
Expand Down Expand Up @@ -33,7 +33,8 @@ and development of the project.
- [ ] **Project Initialization and Documentation**
- [ ] Internal AI Project intake and criteria for internal AI products.
- [ ] Product functionality explained in the Wiki.
- [ ] [GitHub project created](https://github.com/orgs/ai-cfia/projects) for managing the product.
- [ ] [GitHub project created](https://github.com/orgs/ai-cfia/projects)
for managing the product.
- [ ] [Configure repository to our own internal standards](https://github.com/ai-cfia/devops/blob/main/github-repository-creation-guide.md).
- [ ] Architecture documented with a diagram.

Expand Down
14 changes: 7 additions & 7 deletions Development-Environment-Setup-Guide/DEV-ENV-SETUP.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ commands without `sudo`.
3. Open terminal: `Terminal > New Terminal` or `` Ctrl+` ``.
4. Create your project's folder in your working directory:

```bash
mkdir <your-project-folder>
```
```bash
mkdir <your-project-folder>
```

5. In Command Palette, select `WSL: Open Folder in WSL...` and choose your
project folder.
Expand Down Expand Up @@ -76,14 +76,14 @@ Make sure to include the following fields:
- **name**: Container name for VS Code.
- **image**: The Docker image to use. We recommended using the Dev Container
base images provided by Microsoft: [Docker Hub]
(https://hub.docker.com/_/microsoft-devcontainers?tab=description).
base images provided by Microsoft: [Docker Hub](
https://hub.docker.com/_/microsoft-devcontainers?tab=description).
- **postCreateCommand**: Commands that will execute after the container's
creation. This is useful for the installation of dependencies or initial
setup tasks.
For a comprehensive list of options, refer to the [official documentation]
(https://containers.dev/implementors/json_reference/).
For a comprehensive list of options, refer to the [official documentation](
https://containers.dev/implementors/json_reference/).
#### Default extensions
Expand Down
178 changes: 89 additions & 89 deletions Minimal-Backend-Setup-Guides/PYTHON-BACKEND-SETUP.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,143 +21,143 @@ after the issue (ie, `<username>/issue<issue-number>-a-meaningful-tag`)

1. Configure `devcontainer.json`:

```json
{
"name": "Python 3",
"image": "mcr.microsoft.com/devcontainers/python:3.11",
"postCreateCommand": "pip3 install --user -r requirements.txt"
}
```
```json
{
"name": "Python 3",
"image": "mcr.microsoft.com/devcontainers/python:3.11",
"postCreateCommand": "pip3 install --user -r requirements.txt"
}
```

2. At the root of the project, Create a `requirements.txt` file:

```
flask
gunicorn
# additional dependencies
```
```text
flask
gunicorn
# additional dependencies
```

3. Create a `requirements-production.txt` file:

```
flask
gunicorn
```
```text
flask
gunicorn
```

4. Set up the directory structure:

```bash
mkdir src tests && touch src/main.py tests/test_main.py src/__init__.py tests/__init__.py Dockerfile
```
```bash
mkdir src tests && touch src/main.py tests/test_main.py src/__init__.py tests/__init__.py Dockerfile
```

5. Setting up the Flask app:

```python
# src/main.py
from datetime import datetime
from flask import Flask
```python
# src/main.py
from datetime import datetime
from flask import Flask

app = Flask(__name__)
app = Flask(__name__)

@app.route('/')
def read_root():
current_time = datetime.now()
unix_timestamp = int(current_time.timestamp())
return {"current_time": unix_timestamp}
```
@app.route('/')
def read_root():
current_time = datetime.now()
unix_timestamp = int(current_time.timestamp())
return {"current_time": unix_timestamp}
```

**Note**: Don't run the app from the code (i.e., with:
`app.run(host='0.0.0.0', port=8000)`) as this violates several rules
from the [12 factor app](https://12factor.net).
**Note**: Don't run the app from the code (i.e., with:
`app.run(host='0.0.0.0', port=8000)`) as this violates several rules
from the [12 factor app](https://12factor.net).

6. Setting up tests:

```python
# tests/test_main.py
import unittest
from src.main import app
```python
# tests/test_main.py
import unittest
from src.main import app

class TestApp(unittest.TestCase):
class TestApp(unittest.TestCase):

def setUp(self):
self.app = app.test_client()
self.app.testing = True
def setUp(self):
self.app = app.test_client()
self.app.testing = True

def test_read_root(self):
response = self.app.get('/')
data = response.get_json()
self.assertEqual(response.status_code, 200)
self.assertTrue('current_time' in data)
self.assertIsInstance(data['current_time'], int)
```
def test_read_root(self):
response = self.app.get('/')
data = response.get_json()
self.assertEqual(response.status_code, 200)
self.assertTrue('current_time' in data)
self.assertIsInstance(data['current_time'], int)
```

7. Setting up the Dockerfile:

```dockerfile
# Dockerfile
# Base image with Python 3.11 on Alpine
FROM python:3.11-alpine
```dockerfile
# Dockerfile
# Base image with Python 3.11 on Alpine
FROM python:3.11-alpine

# Establish /code as working directory in the container
WORKDIR /code
# Establish /code as working directory in the container
WORKDIR /code

# Copy production requirements and install dependencies
COPY ./requirements-production.txt requirements.txt
RUN pip3 install --no-cache-dir -r requirements.txt
# Copy production requirements and install dependencies
COPY ./requirements-production.txt requirements.txt
RUN pip3 install --no-cache-dir -r requirements.txt

# Copy source code into the working directory
COPY ./src .
# Copy source code into the working directory
COPY ./src .

# Use Gunicorn as the server, configuring it for the Flask app
ENTRYPOINT gunicorn --bind :$PORT --workers 1 --threads 8 --timeout 0 --forwarded-allow-ips "*" main:app
```
# Use Gunicorn as the server, configuring it for the Flask app
ENTRYPOINT gunicorn --bind :$PORT --workers 1 --threads 8 --timeout 0 --forwarded-allow-ips "*" main:app
```

8. Open the project in Dev Containers or rebuild it if it was already open in
Dev Containers.

9. Test the Flask app:

```bash
export PORT=5001
cd src && gunicorn --bind :$PORT --workers 1 --threads 8 --timeout 0 --forwarded-allow-ips "*" main:app
```
```bash
export PORT=5001
cd src && gunicorn --bind :$PORT --workers 1 --threads 8 --timeout 0 --forwarded-allow-ips "*" main:app
```

10. Run the tests. From the root:

```bash
python -m unittest discover -s tests
```
```bash
python -m unittest discover -s tests
```

11. Test running the app from Dockerfile:

```bash
docker build -t flask-app .
docker run -p $PORT:$PORT -e PORT=$PORT flask-app
```
```bash
docker build -t flask-app .
docker run -p $PORT:$PORT -e PORT=$PORT flask-app
```

## Pushing the App to GitHub

1. Create a `.gitignore`:

```
__pycache__/
*.pyc
.cache/
env/
```
```text
__pycache__/
*.pyc
.cache/
env/
```

2. Create a `README.md`:

```
# Presentation
...
# Steps to Run the Project from Dev Containers
...
# Running the unit tests from Dev Containers
...
# Steps to Run the Project from Dockerfile
...
```
```markdown
# Presentation
...
# Steps to Run the Project from Dev Containers
...
# Running the unit tests from Dev Containers
...
# Steps to Run the Project from Dockerfile
...
```

3. Commit and push the changes to the repository. Make sure the commit
references the issue (ie, `issue #<issue-number>`). Make sure the commit message
Expand Down
3 changes: 1 addition & 2 deletions adr/008-naming-convention.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,7 @@ researchers, developers.
- [Rootsoft. Database Naming Convention](#rootsoft)
- [Vertabelo. Worst Database Naming Conventions](#vertabelo)


### Database Table, Column and View
### Database Table, Column and View

- **Convention**: Use lowercase and separate words with underscore. For naming
use plural.
Expand Down
12 changes: 6 additions & 6 deletions adr/016-networking.fr-ca.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

## Résumé exécutif

Cette décision d'architecture vise à formaliser la stratégie de réseautique pour nos applications
déployées sur Kubernetes, en évaluant les composants actuels et futures d'accès
réseau pour maximiser performance, sécurité et facilité de gestion.
Nous utilisons Azure pour cette architecture, en intégrant ingress Nginx,
cert-manager, vouch-proxy, ainsi qu'une gestion automatique des enregistrements
DNS grâce à external-dns.
Cette décision d'architecture vise à formaliser la stratégie de réseautique pour
nos applications déployées sur Kubernetes, en évaluant les composants actuels et
futures d'accès réseau pour maximiser performance, sécurité et facilité de
gestion. Nous utilisons Azure pour cette architecture, en intégrant ingress
Nginx, cert-manager, vouch-proxy, ainsi qu'une gestion automatique des
enregistrements DNS grâce à external-dns.

## Contexte

Expand Down
1 change: 1 addition & 0 deletions development-with-aI/000-index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ multitude of pivotal roles:
## Enhancing Functionality

AI amplifies our system's capabilities by:

- **Automating Processes:** Streamlining complex tasks for increased efficiency.
- **Enabling Smart Decision-Making:** Providing predictive insights from data
analysis.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Coding Journey: Addressing Challenges and Finding Solutions

## Chunk Quality and Missing Scores

During development, one significant challenge revolved around chunk quality
ratings, each assigned a score, ranging from 0.0 to 1.0. However, issues emerged
due to missing scores, specifically in identifying tables within chunks and
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ The system aims to provide valuable Q&A pairs and ensure search result accuracy,
addressing challenges in chunk quality and scoring accuracy along the way.

## Related Links

- [Pull Request #47](https://github.com/ai-cfia/ailab-db/pull/47)
- [Issue #9](https://github.com/ai-cfia/ailab-db/issues/9)
- [Related Issue #4](https://github.com/ai-cfia/finesse-data/issues/4)
Expand Down
12 changes: 6 additions & 6 deletions postmortems/incident-1.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,22 +105,22 @@ maximum upload limite to the nachet backend.

|Action items|Type|Priority|Owner|Tracking bug|
|--------|-------|-------|-------|-------|
|Instrument the application|mitigate|P0|NBT|[issue 50](#ref-50)|
|Instrument the application|mitigate|P0|NBT|[issue 50](#ref50)|

### Nachet frontend team (NFT):

Check failure on line 110 in postmortems/incident-1.md

View workflow job for this annotation

GitHub Actions / markdown-check / markdown-check

Trailing punctuation in heading

postmortems/incident-1.md:110:31 MD026/no-trailing-punctuation Trailing punctuation in heading [Punctuation: ':'] https://github.com/DavidAnson/markdownlint/blob/v0.32.1/doc/md026.md

|Action items|Type|Priority|Owner|Tracking bug|
|--------|-------|-------|-------|-------|
|Instrument the application|mitigate|P0|NFT|[issue 88](#ref-88)|
|Instrument the application|mitigate|P0|NFT|[issue 88](#ref88)|

### DevSecOps Team (DT):

Check failure on line 116 in postmortems/incident-1.md

View workflow job for this annotation

GitHub Actions / markdown-check / markdown-check

Trailing punctuation in heading

postmortems/incident-1.md:116:24 MD026/no-trailing-punctuation Trailing punctuation in heading [Punctuation: ':'] https://github.com/DavidAnson/markdownlint/blob/v0.32.1/doc/md026.md

|Action items|Type|Priority|Owner|Tracking bug|
|--------|-------|-------|-------|-------|
|Monitor API Key regeneration|detect|P1|DT|[issue 22](#ref-22)|
|Add 500 internal server error alerts|detect|P1|DT|[issue 23](#ref-23)|
|Disallow API Key changes without approval|mitigate|P1|DT|[issue 21](#ref-21)|
|Support instrumented applications|mitigate|P1|DT|[issue 13](#ref-13)|
|Monitor API Key regeneration|detect|P1|DT|[issue 22](#ref22)|
|Add 500 internal server error alerts|detect|P1|DT|[issue 23](#ref23)|
|Disallow API Key changes without approval|mitigate|P1|DT|[issue 21](#ref21)|
|Support instrumented applications|mitigate|P1|DT|[issue 13](#ref13)|

## Lessons Learned

Expand Down

0 comments on commit 52ee2e2

Please sign in to comment.