Blog. Repository of ideas/solutions. Web Developer. Data Labandero. Python. TypeScript. Dart. Flutter apps. VB6 free since 2003!
Monday, February 13, 2023
Notes on Different Docker image tags
Wednesday, January 11, 2023
Notes for Setting up Django for ASGI with Gunicorn, Uvicorn, Docker and Websockets
Gunicorn is a robust web server that has monitoring and automatic restarts. Perfect for production deployments.
Uvicorn is an ASGI server based on uvloop and httptools, with emphasis on speed.
ASGI means Asynchronous Server Gateway Interface intended for async-capable Python web servers, frameworks and apps. The other side of the coin is WSGI. TL:DR: ASGI = asynchronous, WSGI=synchronous
Installing
$ pip install gunicorn uvicorn[standard]
Running with Docker
$ gunicorn my_project.asgi:application -b 0.0.0.0:8000 --reload -k uvicorn.workers.UvicornWorker Why not daphne server?
Wednesday, December 21, 2022
Dumping and Restoring a DB from host into a Docker container or back
Assuming you have the sql (ie. backup.sql) file on hand:
To create a backup of a mysql DB (ie. dumping it):
$ docker exec CONTAINER_NAME /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
$ cat backup.sql | docker exec -i CONTAINER_NAME /usr/bin/mysql -u root --password=root DATABASE ref: https://stackoverflow.com/questions/46579381/how-to-restore-mysql-dump-from-host-to-docker-container