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
| testdb=> SELECT name,setting,unit FROM pg_settings; | |
| name | setting | unit | |
| ---------------------------------+---------------------------------------------+------ | |
| allow_system_table_mods | off | | |
| application_name | psql | | |
| archive_command | /etc/rds/dbbin/pgscripts/rds_wal_archive %p | | |
| archive_mode | on | | |
| archive_timeout | 300 | s | |
| array_nulls | on | | |
| authentication_timeout | 60 | s |
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
| go to | |
| cd /etc/postgresql/10/main | |
| rm postgresql.conf | |
| touch postgresql.conf | |
| nano postgresql.conf | |
| copy and paste below code, get fun :) |
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 channels.auth import AuthMiddlewareStack | |
| from channels.routing import ProtocolTypeRouter, URLRouter | |
| import apps.solicitudes.routing | |
| application = ProtocolTypeRouter({ | |
| "websocket": AuthMiddlewareStack( | |
| URLRouter( | |
| apps.solicitudes.routing.websocket_urlpatterns | |
| ) | |
| ), |
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
| sudo su - | |
| # update so | |
| sudo apt update | |
| sudo apt upgrade | |
| # install curl | |
| sudo apt install curl | |
| #install docker-compose via curl |
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 channels import Group | |
| from channels.auth import channel_session_user_from_http | |
| from channels.sessions import channel_session | |
| from apps.calls.models import Contacto | |
| @channel_session_user_from_http | |
| def connect_update_contacto(message, pk): | |
| contacto = Contacto.objects.get(id=pk) |
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
| server { | |
| server_name domain.com; | |
| location / { | |
| proxy_pass http://localhost:4500; | |
| proxy_http_version 1.1; | |
| proxy_set_header Upgrade $http_upgrade; | |
| proxy_set_header Connection 'upgrade'; | |
| proxy_set_header Host $host; | |
| proxy_cache_bypass $http_upgrade; | |
| } |
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
| # first steps if you have locales issues | |
| sudo dpkg-reconfigure locales | |
| sudo apt install language-pack-en | |
| sudo locale-gen en_US en_US.UTF-8 | |
| nano /etc/default/locale | |
| LANG=en_US.UTF-8 | |
| LC_ALL="en_US.UTF-8” | |
| LANGUAGE="en_US:en" | |
| # first steps :) |
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
| @action(detail=False, methods=['get']) | |
| def published(self, request): | |
| queryset = self.model.objects.all() | |
| page = self.paginate_queryset(queryset) | |
| if page is not None: | |
| serializer = self.get_serializer(page, many=True) | |
| return self.get_paginated_response(serializer.data) | |
| serializer = self.get_serializer(queryset, many=True) | |
| return Response(serializer.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
| # first steps if you have locales issues | |
| sudo dpkg-reconfigure locales | |
| sudo apt install language-pack-en | |
| sudo locale-gen en_US en_US.UTF-8 | |
| nano /etc/default/locale | |
| LANG=en_US.UTF-8 | |
| LC_ALL="en_US.UTF-8” | |
| LANGUAGE="en_US:en" | |
| # first steps :) |
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
| # heroku backup | |
| heroku pg:backups:capture --app heroku_app_name | |
| heroku pg:backups:download --app heroku_app_name | |
| # when the latest.dump are downloaded | |
| pg_restore --verbose --clean --no-acl --no-owner -h my_rds_host -U user -d db latest.dump | |
| # download backup from remote database | |
| pg_dump -h host -U user -C db --file=db_backup.dump |