Skip to content

Instantly share code, notes, and snippets.

View revant's full-sized avatar

Revant Nandgaonkar revant

View GitHub Profile
@revant
revant / Procfile
Last active February 22, 2024 14:17
Use node server with frappe-bench
redis_cache: redis-server config/redis_cache.conf
redis_socketio: redis-server config/redis_socketio.conf
redis_queue: redis-server config/redis_queue.conf
web: bench serve --port 8000
socketio: /usr/bin/node apps/frappe/socketio.js
custom_app: /usr/bin/node apps/custom_app/custom_node.js
watch: bench watch
schedule: bench schedule
worker_short: bench worker --queue short
@revant
revant / nginx-files.conf
Last active February 12, 2024 10:36
Frappe CORS for nginx
location / {
rewrite ^(.+)/$ $1 permanent;
rewrite ^(.+)/index\.html$ $1 permanent;
rewrite ^(.+)\.html$ $1 permanent;
# Allow CORS for static files
add_header Access-Control-Allow-Origin $cors_origin;
add_header Access-Control-Allow-Methods "GET, OPTIONS";
location ~* ^/files/.*.(htm|html|svg|xml) {
@revant
revant / README.md
Last active January 25, 2024 14:43
ERPNext Development for beginners

Prerequisites:

  • "git" things to know
    • create app's git repo
    • create fork repo
    • create feature branch
    • send, approve and accept merge request
    • git tags, prepare release script.
    • push release to HEAD branch, e.g version-13, version-12, etc.
  • docker
@revant
revant / README.md
Last active November 29, 2023 11:23
ERPNext on Docker Swarm
@revant
revant / README.md
Last active November 23, 2023 12:11
Frappe Docker development bench in production

Install frappe-bench using docker

Clone frappe_docker

git clone https://github.com/frappe/frappe_docker.git
cd frappe_docker

Install bench using docker

{
"guestFunctions": [
"erpnext.www.book_appointment.verify.index.get_context(context)",
"erpnext.www.book_appointment.index.get_appointment_settings()",
"erpnext.www.book_appointment.index.get_timezones()",
"erpnext.www.book_appointment.index.get_appointment_slots(date, timezone)",
"erpnext.www.book_appointment.index.create_appointment(date, time, tz, contact)",
"erpnext.templates.utils.send_message(subject='Website Query', message='', sender='', status='Open')",
"erpnext.templates.pages.search_help.get_help_results_sections(text)",
"erpnext.templates.pages.product_search.get_product_list(search=None, start=0, limit=12)",
@revant
revant / smtp.py
Last active November 3, 2023 14:18
Python SMTPServer
# https://github.com/frappe/frappe/blob/develop/frappe/email/smtp.py
import smtplib
class SMTPServer:
def __init__(
self,
server,
login=None,
password=None,
@revant
revant / backup-with-restic-and-s3.md
Last active September 6, 2023 14:46
backup with restic and S3

For local example, start MinIO

docker run \
  -p 9000:9000 \
  -p 9001:9001 \
  --name localminio \
  -v ~/minio/data:/data \
  -e "MINIO_ROOT_USER=AKIAIOSFODNN7EXAMPLE" \
  -e "MINIO_ROOT_PASSWORD=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY" \

Prerequisites

  • EKS Fargate profiles for <fargate-profile-namespace>. Guide
  • EKS Fargate coredns profile for coredns pods to run (create profile for kube-system namespace, refer guide from previous step)
  • EFS CSI Driver installed, mount points set and pv.yaml created. Refer Guide
  • EKS ALB Controller, refer Guide.

Install Helm

Refer Helm Installation to install helm command

def terminal_websocket(name: str, namespace: str, command: list[str], container: str = None):
load_config()
core_v1_api = client.CoreV1Api()
resp = stream(
core_v1_api.connect_get_namespaced_pod_exec,
name=name,
namespace=namespace,
container=container,
command=command,
stderr=True,