Skip to content

Commit b04432e

Browse files
authored
Merge pull request #566 from memeLab/develop
Blog Release & Clean up project
2 parents d2b4431 + 2632e20 commit b04432e

File tree

308 files changed

+8553
-4384
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

308 files changed

+8553
-4384
lines changed

.envs/.example

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Use this file to create a .env with filled variables
2+
# Django Variables
3+
DJANGO_DEBUG=True
4+
DEBUG_TOOLBAR=True
5+
DJANGO_SECRET_KEY=change_me
6+
USE_MINIO=True
7+
8+
# Sentry Variables
9+
DJANGO_ADMIN_URL=jandig-admin/
10+
ENABLE_SENTRY=False
11+
SENTRY_DSN=
12+
HEALTH_CHECK_URL=api/v1/status/
13+
SENTRY_TRACES_SAMPLE_RATE=0.1
14+
15+
## Amazon AWS Variables
16+
AWS_ACCESS_KEY_ID=minio
17+
AWS_SECRET_ACCESS_KEY=minio123
18+
MINIO_ROOT_USER=minio
19+
MINIO_ROOT_PASSWORD=minio123
20+
AWS_STORAGE_BUCKET_NAME=jandig-cdn
21+
AWS_PRIVATE_STORAGE_BUCKET_NAME=jandig-private-cdn
22+
AWS_S3_REGION_NAME=us-east-2
23+
AWS_STATIC_LOCATION=static
24+
MINIO_S3_ENDPOINT_URL=http://storage:9000
25+
MINIO_SITE_REGION=us-east-2
26+
MINIO_USER_ACCESS_KEY=minio-access-key
27+
MINIO_USER_SECRET_KEY=minio-secret-key
28+
29+
## Postgres variables
30+
POSTGRES_HOST=postgres
31+
POSTGRES_PORT=5432
32+
POSTGRES_DB=jandig
33+
POSTGRES_USER=jandig
34+
POSTGRES_PASSWORD=secret
35+
36+
# Email server variables
37+
SMTP_SERVER=smtp.gmail.com
38+
SMTP_PORT=587
39+
40+
JANDIG_EMAIL_PASSWORD=local_password

.github/CODE_OF_CONDUCT.md

Lines changed: 42 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,45 +2,66 @@
22

33
## Our Pledge
44

5-
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
5+
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6+
7+
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
68

79
## Our Standards
810

9-
Examples of behavior that contributes to creating a positive environment include:
11+
Examples of behavior that contributes to a positive environment for our community include:
1012

11-
* Using welcoming and inclusive language
12-
* Being respectful of differing viewpoints and experiences
13-
* Gracefully accepting constructive criticism
14-
* Focusing on what is best for the community
15-
* Showing empathy towards other community members
13+
- Demonstrating empathy and kindness toward other people
14+
- Being respectful of differing opinions, viewpoints, and experiences
15+
- Giving and gracefully accepting constructive feedback
16+
- Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17+
- Focusing on what is best not just for us as individuals, but for the overall community
1618

17-
Examples of unacceptable behavior by participants include:
19+
Examples of unacceptable behavior include:
1820

19-
* The use of sexualized language or imagery and unwelcome sexual attention or advances
20-
* Trolling, insulting/derogatory comments, and personal or political attacks
21-
* Public or private harassment
22-
* Publishing others' private information, such as a physical or electronic address, without explicit permission
23-
* Other conduct which could reasonably be considered inappropriate in a professional setting
21+
- The use of sexualized language or imagery, and sexual attention or advances of any kind
22+
- Trolling, insulting or derogatory comments, and personal or political attacks
23+
- Public or private harassment
24+
- Publishing others private information, such as a physical or email address, without their explicit permission
25+
- Other conduct which could reasonably be considered inappropriate in a professional setting
2426

25-
## Our Responsibilities
27+
## Enforcement Responsibilities
2628

27-
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
29+
Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
2830

29-
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
31+
Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
3032

3133
## Scope
3234

33-
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
35+
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
3436

3537
## Enforcement
3638

37-
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at [email protected]. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
39+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at [email protected]. All complaints will be reviewed and investigated promptly and fairly.
40+
41+
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
42+
43+
## Enforcement Guidelines
44+
Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
45+
46+
1. Correction <br><br>
47+
**Community Impact:** Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community. <br><br>
48+
**Consequence:** A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
49+
50+
2. Warning <br><br>
51+
**Community Impact:** A violation through a single incident or series of actions. <br><br>
52+
**Consequence:** A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
53+
54+
3. Temporary Ban <br><br>
55+
**Community Impact:** A serious violation of community standards, including sustained inappropriate behavior. <br><br>
56+
**Consequence:** A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
3857

39-
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
58+
4. Permanent Ban <br><br>
59+
**Community Impact:** Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals. <br><br>
60+
**Consequence:** A permanent ban from any sort of public interaction within the community.
4061

4162
## Attribution
4263

43-
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
64+
This Code of Conduct is adapted from the [Contributor Covenant][homepage] version 2.0, available at [https://www.contributor-covenant.org/version/2/0/code_of_conduct.html][version].
4465

4566
[homepage]: http://contributor-covenant.org
46-
[version]: http://contributor-covenant.org/version/1/4/
67+
[version]: https://www.contributor-covenant.org/version/2/0/code_of_conduct.html

.github/workflows/ci.yml

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
name: CI pipeline
2+
3+
on: push
4+
5+
jobs:
6+
linter:
7+
name: run / linter
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Check out code from Github
11+
uses: actions/checkout@v3
12+
- name: Set up Python 3.10
13+
uses: actions/setup-python@v4
14+
with:
15+
python-version: "3.10"
16+
- name: Installing flake8
17+
run: |
18+
python -m pip install --upgrade pip
19+
pip install flake8
20+
- name: Run flake8 linter
21+
run: |
22+
flake8 --max-line-length=200 --exclude=*/migrations src/
23+
24+
build:
25+
name: run / build
26+
runs-on: ubuntu-latest
27+
needs: linter
28+
steps:
29+
- name: Check out code from Github
30+
uses: actions/checkout@v3
31+
- name: Build image
32+
run: |
33+
# docker login -u $DOCKER_HUB_USER -p $DOCKER_HUB_PASS
34+
docker build . -t jandigarte/django:$GITHUB_SHA
35+
docker save -o docker_image_$GITHUB_SHA jandigarte/django:$GITHUB_SHA
36+
- name: Caching image
37+
uses: actions/cache@v3
38+
with:
39+
key: jandigarte
40+
path: docker_image_${{ github.sha }}
41+
42+
migrations:
43+
name: test / migrations
44+
runs-on: ubuntu-latest
45+
needs: build
46+
steps:
47+
- name: Check out code from Github
48+
uses: actions/checkout@v3
49+
- name: Restoring cached image
50+
uses: actions/cache@v3
51+
with:
52+
key: jandigarte
53+
path: docker_image_${{ github.sha }}
54+
- name: Running container
55+
env:
56+
IMAGE_NAME: jandigarte/django:${{ github.sha }}
57+
run: |
58+
cp .envs/.example .envs/.env
59+
docker load -i docker_image_$GITHUB_SHA
60+
docker-compose -f docker-compose.ci.yml -p jandigarte_$GITHUB_SHA up --no-build -d
61+
- name: Test migrations
62+
run: |
63+
docker exec jandigarte_${{ github.sha }}_django_1 sh -c "\
64+
poetry run src/manage.py makemigrations --check --dry-run"
65+
66+
test:
67+
name: test / unity
68+
runs-on: ubuntu-latest
69+
needs: build
70+
steps:
71+
- name: Check out code from Github
72+
uses: actions/checkout@v3
73+
- name: Restoring cached image
74+
uses: actions/cache@v3
75+
with:
76+
key: jandigarte
77+
path: docker_image_${{ github.sha }}
78+
- name: Running container
79+
env:
80+
IMAGE_NAME: jandigarte/django:${{ github.sha }}
81+
run: |
82+
cp .envs/.example .envs/.env
83+
docker load -i docker_image_$GITHUB_SHA
84+
docker-compose -f docker-compose.ci.yml -p jandigarte_$GITHUB_SHA up --no-build -d
85+
- name: Running users tests
86+
run: |
87+
docker exec jandigarte_${{ github.sha }}_django_1 sh -c "\
88+
poetry run src/manage.py test"

.github/workflows/dependencies.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Dependencies pipeline
2+
3+
on:
4+
push:
5+
paths:
6+
- 'pyproject.toml'
7+
8+
jobs:
9+
dependencies:
10+
name: test / dependencies
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Check out code from Github
14+
uses: actions/checkout@v3
15+
- name: Check diff
16+
id: diff_lock
17+
run: |
18+
echo "::set-output name=dependencies::$(git diff --name-only | grep poetry.lock -c)"
19+
- name: Check poetry lock
20+
if: ${{ steps.diff_lock.outputs.dependencies == 0 }}
21+
run: exit 1

.github/workflows/push.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Docker pipeline
2+
3+
on:
4+
push:
5+
branches:
6+
- develop
7+
8+
# TODO: Change environment and login envs
9+
jobs:
10+
django:
11+
name: push / django
12+
environment: testes
13+
runs-on: ubuntu-latest
14+
needs: dependencies
15+
steps:
16+
- name: Check out code from Github
17+
uses: actions/checkout@v3
18+
- name: Build django image
19+
run: |
20+
docker build . -t jandigarte/django:latest
21+
- name: Push django image
22+
run: |
23+
docker login -u ${{ secrets.DOCKER_HUB_USER }} -p ${{ secrets.DOCKER_HUB_PASS }}
24+
docker push jandigarte/django:latest

.gitignore

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
src/ARte/config/__pycache__/
33
*.pyc
44

5-
##vscode
6-
\.vscode/
7-
85
##sqlite
96
*.sqlite3
107

@@ -25,4 +22,4 @@ docker/media/
2522
*.mo
2623
*.po~
2724

28-
src/.envs/.env
25+
*/**/.env

.gitlab-ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ stages:
88
- docker:dind
99
script:
1010
- docker login -u $DOCKER_HUB_USER -p $DOCKER_HUB_PASS
11-
- docker build . -f docker/Dockerfile -t jandigarte/django:$DOCKER_TAG --cache-from jandigarte/django:$DOCKER_TAG
11+
- docker build . -t jandigarte/django:$DOCKER_TAG --cache-from jandigarte/django:$DOCKER_TAG
1212
- docker push jandigarte/django:$DOCKER_TAG
1313
tags:
14-
- docker
14+
- gitlab-org-docker
1515

1616
build develop:
1717
extends: .build
@@ -32,7 +32,7 @@ build tag:
3232
environment: production
3333
script:
3434
- docker login -u $DOCKER_HUB_USER -p $DOCKER_HUB_PASS
35-
- "docker build . -f docker/Dockerfile
35+
- "docker build .
3636
-t jandigarte/django:$CI_COMMIT_TAG
3737
-t jandigarte/django:$DOCKER_TAG
3838
-t jandigarte/django:latest"

.vscode/settings.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"python.testing.pytestArgs": [
3+
"src",
4+
"--ds=config.test_settings",
5+
],
6+
"python.testing.unittestEnabled": false,
7+
"python.testing.pytestEnabled": true
8+
}

Dockerfile

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
FROM python:3.10-slim-bullseye
2+
3+
RUN apt-get update && \
4+
apt-get install -y --no-install-recommends \
5+
gettext \
6+
docutils-common \
7+
curl \
8+
wget
9+
10+
COPY ./pyproject.toml /pyproject.toml
11+
COPY ./poetry.lock /poetry.lock
12+
13+
ENV PATH="$PATH:/root/.local/bin" \
14+
POETRY_NO_INTERACTION=1 \
15+
POETRY_VIRTUALENVS_CREATE=false \
16+
POETRY_CACHE_DIR='/var/cache/pypoetry' \
17+
TINI_VERSION=v0.19.0 \
18+
# poetry:
19+
POETRY_VERSION=1.3.1
20+
21+
# Installing `poetry` package manager:
22+
# https://github.com/python-poetry/poetry
23+
RUN curl -sSL https://install.python-poetry.org | python3 - \
24+
&& poetry --version
25+
26+
RUN pip install --upgrade pip
27+
RUN poetry install
28+
29+
RUN dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')" \
30+
&& wget "https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-${dpkgArch}" -O /usr/local/bin/tini \
31+
&& chmod +x /usr/local/bin/tini && tini --version
32+
33+
34+
RUN mkdir -p /jandig/src /jandig/locale /jandig/docs /jandig/static /jandig/build
35+
36+
WORKDIR /jandig
37+
38+
COPY ./src/ /jandig/src/
39+
COPY ./docs/ /jandig/docs/
40+
COPY ./locale/ /jandig/locale/
41+
COPY ./tasks.py /jandig/tasks.py
42+
COPY ./run.sh /jandig/run.sh
43+
COPY ./etc/ /jandig/etc/
44+
45+
46+
RUN find . | grep -E "(__pycache__|\.pyc|\.pyo$)" | xargs rm -rf
47+
48+
49+
ENTRYPOINT ["tini", "--"]

0 commit comments

Comments
 (0)