-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #116 from nossas/feature/monitoring
Feature/monitoring
- Loading branch information
Showing
9 changed files
with
221 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# Build staticfiles | ||
FROM node:18-alpine AS node-builder | ||
|
||
WORKDIR /app | ||
|
||
COPY /app . | ||
|
||
WORKDIR /app/tailwind | ||
|
||
RUN npm i | ||
|
||
RUN npm run page:build | ||
|
||
RUN npm run admin:build | ||
|
||
# Use an official Python runtime based on Debian 10 "buster" as a parent image. | ||
FROM python:slim-buster | ||
|
||
# Port used by this container to serve HTTP. | ||
EXPOSE 8000 | ||
|
||
# Set environment variables. | ||
# 1. Force Python stdout and stderr streams to be unbuffered. | ||
# 2. Set PORT variable that is used by Gunicorn. This should match "EXPOSE" | ||
# command. | ||
ENV PYTHONUNBUFFERED=1 \ | ||
PORT=8000 | ||
|
||
# Install system packages required by Django CMS and Django. | ||
RUN apt-get update --yes --quiet && apt-get install --yes --quiet --no-install-recommends \ | ||
build-essential \ | ||
cargo \ | ||
libssl-dev \ | ||
libffi-dev \ | ||
sox \ | ||
ffmpeg \ | ||
libcairo2 \ | ||
libcairo2-dev \ | ||
python3-dev \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Install the application server. | ||
RUN pip install uwsgi django-storages boto3 django-prometheus | ||
|
||
# Install the project requirements. | ||
COPY app/requirements.txt / | ||
RUN pip install -r requirements.txt | ||
|
||
# Use /app folder as a directory where the source code is stored. | ||
WORKDIR /app | ||
|
||
# Copy the source code of the project into the container. | ||
COPY --from=node-builder /app ./ | ||
|
||
RUN python manage.py collectstatic --noinput --clear -i tailwindcss | ||
|
||
# Runtime command that executes when "docker run" is called. | ||
CMD ["uwsgi", "--ini", "/app/wsgi.ini"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,4 +17,4 @@ bcrypt | |
whitenoise | ||
svglib | ||
reportlab | ||
django-social-share | ||
django-social-share |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,77 @@ | ||
services: | ||
web: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
ports: | ||
- "80:8000" | ||
env_file: | ||
- .env-local | ||
depends_on: | ||
- db | ||
# web: | ||
# build: | ||
# context: . | ||
# dockerfile: Dockerfile.local | ||
# # image: nossas/cms:main | ||
# networks: | ||
# - bonde | ||
# ports: | ||
# - "80:8000" | ||
# env_file: | ||
# - .env-local | ||
# depends_on: | ||
# - db | ||
|
||
db: | ||
image: postgres:latest | ||
restart: always | ||
environment: | ||
- POSTGRES_USER=postgres | ||
- POSTGRES_PASSWORD=postgres | ||
- POSTGRES_DB=cms | ||
# logging: | ||
# options: | ||
# max-size: 10m | ||
# max-file: "3" | ||
ports: | ||
- '5432:5432' | ||
volumes: | ||
- /tmp/data:/var/lib/postgresql/data | ||
# db: | ||
# image: postgres:latest | ||
# restart: always | ||
# environment: | ||
# - POSTGRES_USER=postgres | ||
# - POSTGRES_PASSWORD=postgres | ||
# - POSTGRES_DB=cms | ||
# # logging: | ||
# # options: | ||
# # max-size: 10m | ||
# # max-file: "3" | ||
# networks: | ||
# - bonde | ||
# ports: | ||
# - '5432:5432' | ||
# volumes: | ||
# - /tmp/data:/var/lib/postgresql/data | ||
|
||
prometheus: | ||
image: prom/prometheus | ||
restart: 'no' | ||
user: root | ||
volumes: | ||
- /tmp/prometheus_data:/prometheus | ||
- ./deploy/prometheus.yml:/etc/prometheus/prometheus.yml | ||
# networks: | ||
# - bonde | ||
# ports: | ||
# - 9090:9090 | ||
network_mode: "host" | ||
# depends_on: | ||
# - web | ||
|
||
grafana: | ||
image: grafana/grafana | ||
user: root | ||
environment: | ||
GF_INSTALL_PLUGINS: "grafana-clock-panel,grafana-simple-json-datasource" | ||
restart: 'no' | ||
volumes: | ||
- /tmp/grafana_data:/var/lib/grafana | ||
# networks: | ||
# - bonde | ||
# ports: | ||
# - 3000:3000 | ||
network_mode: "host" | ||
depends_on: | ||
- prometheus | ||
|
||
redis: | ||
image: redis:6.2-alpine | ||
restart: always | ||
command: redis-server --save 20 1 --loglevel warning --requirepass eYVX7EwVmmxKPCDmwMtyKVge8oLd2t81 | ||
# ports: | ||
# - '6379:6379' | ||
network_mode: "host" | ||
volumes: | ||
- /tmp/redis_data:/data | ||
|
||
# networks: | ||
# bonde: | ||
# external: True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from locust import HttpUser, task | ||
|
||
class SimulateRequestOverUser(HttpUser): | ||
|
||
@task | ||
def index(self): | ||
self.client.get("/") | ||
|
||
@task | ||
def list(self): | ||
self.client.get("/candidaturas/") | ||
|
||
@task | ||
def admin(self): | ||
self.client.get("/admin") | ||
|
||
@task | ||
def not_found(self): | ||
self.client.get("/not_found/asdasdasd") | ||
|
||
@task | ||
def form(self): | ||
self.client.get("/candidaturas/cadastro/") |