sudo apt-get update
sudo apt-get -y upgrade
echo "deb http://repo.pritunl.com/stable/apt focal main" | sudo tee /etc/apt/sources.list.d/pritunl.list
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list
curl -fsSL https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add -
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com --recv 9DA31620334BD75D9DCB49F368818C72E52529D4
sudo apt update
This file contains hidden or 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
version: '3' | |
services: | |
db: | |
restart: always | |
image: postgres:14-alpine | |
shm_size: 256mb | |
healthcheck: | |
test: ['CMD', 'pg_isready', '-U', 'postgres'] | |
volumes: | |
- ./postgres14:/var/lib/postgresql/data |
This file contains hidden or 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
kind: ServiceAccount | |
apiVersion: v1 | |
metadata: | |
name: restart-deploy | |
namespace: testns | |
--- | |
apiVersion: rbac.authorization.k8s.io/v1 | |
kind: Role | |
metadata: |
This file contains hidden or 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
I choosed host path mapping for postgresql data directory in a separate OS disk to be able to resize partition later. | |
You can use docker standart volumes too. | |
# mkdir -p /data/timescaledb | |
# cat docker-compose.yml | |
version: '3' | |
services: |
This file contains hidden or 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
ssl_certificate /etc/nginx/ssl/sonar.domain.tld/cert.pem; | |
ssl_certificate_key /etc/nginx/ssl/sonar.domain.tld/privkey.pem; | |
upstream sonar { | |
server 127.0.0.1:9000 fail_timeout=0; | |
} | |
server { | |
listen 80; | |
server_name sonar.domain.tld; |
This file contains hidden or 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
from django.contrib.auth.models import User, Group | |
from rest_framework import permissions | |
def is_in_group(user, group_name): | |
try: | |
return Group.objects.get(name=group_name).user_set.filter(id=user.id).exists() | |
except Group.DoesNotExist: | |
return False | |
class HasGroupPermission(permissions.BasePermission): |
generated via plantuml
This file contains hidden or 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
Siyah ş’utz’e ш1уц1э | |
Beyaz fıjı фыжьы | |
Kırmızı ptlıjı плъыжьы | |
Kahverengi haptlı хьаплъы | |
Yeşil vıtzışo уцышъо |
In this session, we are going to mimic a posts api that we worked on in a previous class. Typecode provides the free sample api.
APIs are what enable the backend, frontend and your mobile application to work together. We have also seen how to build basic REST api using Django Rest Framework
To get the post API to work we will need to work on four modules:
NewerOlder