[{"content":"#define CFG_TUD_MSC 1 #define EPNUM_MSC_OUT 0x03 #define EPNUM_MSC_IN 0x83 #define CONFIG_TOTAL_LEN (TUD_CONFIG_DESC_LEN + CFG_TUD_CDC * TUD_CDC_DESC_LEN + TUD_MSC_DESC_LEN) uint8_t const desc_fs_configuration[] = { TUD_CONFIG_DESCRIPTOR(1, ITF_NUM_TOTAL, 0, CONFIG_TOTAL_LEN, 0x00, 100), TUD_CDC_DESCRIPTOR(ITF_NUM_CDC_0, 4, EPNUM_CDC_0_NOTIF, 8, EPNUM_CDC_0_OUT, EPNUM_CDC_0_IN, 64), TUD_MSC_DESCRIPTOR(ITF_NUM_MSC, 0, EPNUM_MSC_OUT, EPNUM_MSC_IN, 64), }; add msc_disk.c #include \u0026#34;tusb.h\u0026#34; #if CFG_TUD_MSC enum { DISK_BLOCK_NUM = 16, // 8KB DISK_BLOCK_SIZE = 512 }; #define README_CONTENTS \\ \u0026#34;TinyUSB MSC on MM32F0163D7P\\r\\n\\r\\n\\ CDC + MSC Composite Device Demo\u0026#34; uint8_t msc_disk[DISK_BLOCK_NUM][DISK_BLOCK_SIZE] = { // Block0: Boot Sector (FAT12) { 0xEB, 0x3C, 0x90, 0x4D, 0x53, 0x44, 0x4F, 0x53, 0x35, 0x2E, 0x30, 0x00, 0x02, 0x01, 0x01, 0x00, 0x01, 0x10, 0x00, 0x10, 0x00, 0xF8, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x29, 0x34, 0x12, 0x00, 0x00, \u0026#39;T\u0026#39; , \u0026#39;i\u0026#39; , \u0026#39;n\u0026#39; , \u0026#39;y\u0026#39; , \u0026#39;U\u0026#39; , \u0026#39;S\u0026#39; , \u0026#39;B\u0026#39; , \u0026#39; \u0026#39; , \u0026#39;M\u0026#39; , \u0026#39;S\u0026#39; , \u0026#39;C\u0026#39; , 0x46, 0x41, 0x54, 0x31, 0x32, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0xAA }, // Block1: FAT12 Table { 0xF8, 0xFF, 0xFF, 0xFF, 0x0F }, // Block2: Root Directory { \u0026#39;T\u0026#39; , \u0026#39;i\u0026#39; , \u0026#39;n\u0026#39; , \u0026#39;y\u0026#39; , \u0026#39;U\u0026#39; , \u0026#39;S\u0026#39; , \u0026#39;B\u0026#39; , \u0026#39; \u0026#39; , \u0026#39;M\u0026#39; , \u0026#39;S\u0026#39; , \u0026#39;C\u0026#39; , 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4F, 0x6D, 0x65, 0x43, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \u0026#39;R\u0026#39; , \u0026#39;E\u0026#39; , \u0026#39;A\u0026#39; , \u0026#39;D\u0026#39; , \u0026#39;M\u0026#39; , \u0026#39;E\u0026#39; , \u0026#39; \u0026#39; , \u0026#39; \u0026#39; , \u0026#39;T\u0026#39; , \u0026#39;X\u0026#39; , \u0026#39;T\u0026#39; , 0x20, 0x00, 0xC6, 0x52, 0x6D, 0x65, 0x43, 0x65, 0x43, 0x00, 0x00, 0x88, 0x6D, 0x65, 0x43, 0x02, 0x00, sizeof(README_CONTENTS)-1, 0x00, 0x00, 0x00 }, // Block3: Readme Content README_CONTENTS }; uint8_t tud_msc_get_maxlun_cb(void) { return 1; // single LUN } void tud_msc_inquiry_cb(uint8_t lun, uint8_t vendor_id[8], uint8_t product_id[16], uint8_t product_rev[4]) { (void) lun; const char vid[] = \u0026#34;MM32\u0026#34;; const char pid[] = \u0026#34;CDC+MSC\u0026#34;; const char rev[] = \u0026#34;1.0\u0026#34;; memcpy(vendor_id , vid, strlen(vid)); memcpy(product_id , pid, strlen(pid)); memcpy(product_rev, rev, strlen(rev)); } bool tud_msc_test_unit_ready_cb(uint8_t lun) { (void) lun; return true; } void tud_msc_capacity_cb(uint8_t lun, uint32_t* block_count, uint16_t* block_size) { (void) lun; *block_count = DISK_BLOCK_NUM; *block_size = DISK_BLOCK_SIZE; } bool tud_msc_start_stop_cb(uint8_t lun, uint8_t power_condition, bool start, bool load_eject) { (void) lun; (void) power_condition; (void) start; (void) load_eject; return true; } int32_t tud_msc_read10_cb(uint8_t lun, uint32_t lba, uint32_t offset, void* buffer, uint32_t bufsize) { (void) lun; if (lba \u0026gt;= DISK_BLOCK_NUM) return -1; memcpy(buffer, msc_disk[lba] + offset, bufsize); return bufsize; } bool tud_msc_is_writable_cb(uint8_t lun) { (void) lun; return true; } int32_t tud_msc_write10_cb(uint8_t lun, uint32_t lba, uint32_t offset, uint8_t* buffer, uint32_t bufsize) { (void) lun; if (lba \u0026gt;= DISK_BLOCK_NUM) return -1; memcpy(msc_disk[lba] + offset, buffer, bufsize); return bufsize; } void tud_msc_eject_cb(uint8_t lun) { (void) lun; } int32_t tud_msc_scsi_cb(uint8_t lun, uint8_t const scsi_cmd[16], void* buffer, uint16_t bufsize) { (void) lun; (void) scsi_cmd; (void) buffer; tud_msc_set_sense(lun, SCSI_SENSE_ILLEGAL_REQUEST, 0x20, 0x00); return -1; } #endif switch to ARM Compiler 6\nwarning\nKeil → Options for Target → C/C++ (AC6) → Misc Controls add -Wno-macro-redefined tinyusb_device_dual_cdc.c add #include \u0026lt;ctype.h\u0026gt;\n","permalink":"https://gogo.anthony42.eu.org/posts/mm32-cdc-msc/","summary":"\u003cpre tabindex=\"0\"\u003e\u003ccode\u003e#define CFG_TUD_MSC               1\n#define EPNUM_MSC_OUT   0x03\n#define EPNUM_MSC_IN    0x83\n#define CONFIG_TOTAL_LEN    (TUD_CONFIG_DESC_LEN + CFG_TUD_CDC * TUD_CDC_DESC_LEN + TUD_MSC_DESC_LEN)\nuint8_t const desc_fs_configuration[] =\n{\n  TUD_CONFIG_DESCRIPTOR(1, ITF_NUM_TOTAL, 0, CONFIG_TOTAL_LEN, 0x00, 100),\n  TUD_CDC_DESCRIPTOR(ITF_NUM_CDC_0, 4, EPNUM_CDC_0_NOTIF, 8, EPNUM_CDC_0_OUT, EPNUM_CDC_0_IN, 64),\n  TUD_MSC_DESCRIPTOR(ITF_NUM_MSC, 0, EPNUM_MSC_OUT, EPNUM_MSC_IN, 64), \n};\n\u003c/code\u003e\u003c/pre\u003e\u003cul\u003e\n\u003cli\u003eadd \u003ccode\u003emsc_disk.c\u003c/code\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003cpre tabindex=\"0\"\u003e\u003ccode\u003e#include \u0026#34;tusb.h\u0026#34;\n\n#if CFG_TUD_MSC\n\nenum\n{\n  DISK_BLOCK_NUM  = 16,  // 8KB\n  DISK_BLOCK_SIZE = 512\n};\n\n#define README_CONTENTS \\\n\u0026#34;TinyUSB MSC on MM32F0163D7P\\r\\n\\r\\n\\\nCDC + MSC Composite Device Demo\u0026#34;\n\nuint8_t msc_disk[DISK_BLOCK_NUM][DISK_BLOCK_SIZE] =\n{\n  // Block0: Boot Sector (FAT12)\n  {\n      0xEB, 0x3C, 0x90, 0x4D, 0x53, 0x44, 0x4F, 0x53, 0x35, 0x2E, 0x30, 0x00, 0x02, 0x01, 0x01, 0x00,\n      0x01, 0x10, 0x00, 0x10, 0x00, 0xF8, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,\n      0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x29, 0x34, 0x12, 0x00, 0x00, \u0026#39;T\u0026#39; , \u0026#39;i\u0026#39; , \u0026#39;n\u0026#39; , \u0026#39;y\u0026#39; , \u0026#39;U\u0026#39; ,\n      \u0026#39;S\u0026#39; , \u0026#39;B\u0026#39; , \u0026#39; \u0026#39; , \u0026#39;M\u0026#39; , \u0026#39;S\u0026#39; , \u0026#39;C\u0026#39; , 0x46, 0x41, 0x54, 0x31, 0x32, 0x20, 0x20, 0x20, 0x00, 0x00,\n      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0xAA\n  },\n\n  // Block1: FAT12 Table\n  {\n      0xF8, 0xFF, 0xFF, 0xFF, 0x0F\n  },\n\n  // Block2: Root Directory\n  {\n      \u0026#39;T\u0026#39; , \u0026#39;i\u0026#39; , \u0026#39;n\u0026#39; , \u0026#39;y\u0026#39; , \u0026#39;U\u0026#39; , \u0026#39;S\u0026#39; , \u0026#39;B\u0026#39; , \u0026#39; \u0026#39; , \u0026#39;M\u0026#39; , \u0026#39;S\u0026#39; , \u0026#39;C\u0026#39; , 0x08, 0x00, 0x00, 0x00, 0x00,\n      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4F, 0x6D, 0x65, 0x43, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n      \u0026#39;R\u0026#39; , \u0026#39;E\u0026#39; , \u0026#39;A\u0026#39; , \u0026#39;D\u0026#39; , \u0026#39;M\u0026#39; , \u0026#39;E\u0026#39; , \u0026#39; \u0026#39; , \u0026#39; \u0026#39; , \u0026#39;T\u0026#39; , \u0026#39;X\u0026#39; , \u0026#39;T\u0026#39; , 0x20, 0x00, 0xC6, 0x52, 0x6D,\n      0x65, 0x43, 0x65, 0x43, 0x00, 0x00, 0x88, 0x6D, 0x65, 0x43, 0x02, 0x00,\n      sizeof(README_CONTENTS)-1, 0x00, 0x00, 0x00\n  },\n\n  // Block3: Readme Content\n  README_CONTENTS\n};\n\nuint8_t tud_msc_get_maxlun_cb(void)\n{\n  return 1; // single LUN\n}\n\nvoid tud_msc_inquiry_cb(uint8_t lun, uint8_t vendor_id[8], uint8_t product_id[16], uint8_t product_rev[4])\n{\n  (void) lun;\n  const char vid[] = \u0026#34;MM32\u0026#34;;\n  const char pid[] = \u0026#34;CDC+MSC\u0026#34;;\n  const char rev[] = \u0026#34;1.0\u0026#34;;\n  memcpy(vendor_id  , vid, strlen(vid));\n  memcpy(product_id , pid, strlen(pid));\n  memcpy(product_rev, rev, strlen(rev));\n}\n\nbool tud_msc_test_unit_ready_cb(uint8_t lun)\n{\n  (void) lun;\n  return true;\n}\n\nvoid tud_msc_capacity_cb(uint8_t lun, uint32_t* block_count, uint16_t* block_size)\n{\n  (void) lun;\n  *block_count = DISK_BLOCK_NUM;\n  *block_size  = DISK_BLOCK_SIZE;\n}\n\nbool tud_msc_start_stop_cb(uint8_t lun, uint8_t power_condition, bool start, bool load_eject)\n{\n  (void) lun; (void) power_condition; (void) start; (void) load_eject;\n  return true;\n}\n\nint32_t tud_msc_read10_cb(uint8_t lun, uint32_t lba, uint32_t offset, void* buffer, uint32_t bufsize)\n{\n  (void) lun;\n  if (lba \u0026gt;= DISK_BLOCK_NUM) return -1;\n  memcpy(buffer, msc_disk[lba] + offset, bufsize);\n  return bufsize;\n}\n\nbool tud_msc_is_writable_cb(uint8_t lun)\n{\n  (void) lun;\n  return true;\n}\n\nint32_t tud_msc_write10_cb(uint8_t lun, uint32_t lba, uint32_t offset, uint8_t* buffer, uint32_t bufsize)\n{\n  (void) lun;\n  if (lba \u0026gt;= DISK_BLOCK_NUM) return -1;\n  memcpy(msc_disk[lba] + offset, buffer, bufsize);\n  return bufsize;\n}\n\nvoid tud_msc_eject_cb(uint8_t lun)\n{\n  (void) lun;\n}\n\nint32_t tud_msc_scsi_cb(uint8_t lun, uint8_t const scsi_cmd[16], void* buffer, uint16_t bufsize)\n{\n  (void) lun; (void) scsi_cmd; (void) buffer;\n  tud_msc_set_sense(lun, SCSI_SENSE_ILLEGAL_REQUEST, 0x20, 0x00);\n  return -1;\n}\n\n#endif\n\u003c/code\u003e\u003c/pre\u003e\u003cul\u003e\n\u003cli\u003e\n\u003cp\u003eswitch to ARM Compiler 6\u003c/p\u003e","title":"MM32 CDC MSC"},{"content":"nginx cfg location /webhook/ { allow 140.82.112.0/20; allow 192.30.252.0/22; allow 185.199.108.0/22; allow 127.0.0.1; deny all; proxy_pass http://127.0.0.1:9000/hooks/; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_read_timeout 120s; proxy_buffering off; } location ~* \\.(jpg|jpeg|png|gif|ico|css|js|svg|woff|woff2|ttf|eot|webp)$ { expires 30d; add_header Cache-Control \u0026#34;public, immutable\u0026#34;; log_not_found off; access_log off; } location ~* \\.(html|htm|xml|txt|json)$ { expires 1h; add_header Cache-Control \u0026#34;public\u0026#34;; } location ~ /\\. { deny all; access_log off; log_not_found off; } location ~* \\.(sql|bak|backup|sh|log|ini|conf|yml|yaml|md)$ { deny all; return 404; } /etc/systemd/system/webhook.service [Unit] Description=Webhook Service After=network.target [Service] Type=simple User=root Group=root ExecStart=/usr/local/bin/webhook -ip 127.0.0.1 -port 9000 -hooks /etc/webhook/hooks.json -verbose Restart=always RestartSec=5 [Install] WantedBy=multi-user.target deploy #!/bin/bash SOURCE_DIR=\u0026#34;/home/anthony/blog-source\u0026#34; WEB_DIR=\u0026#34;/var/www/blog\u0026#34; LOG_FILE=\u0026#34;/var/log/webhook/deploy.log\u0026#34; echo \u0026#34;$(date): ========== start deploy ==========\u0026#34; \u0026gt;\u0026gt; $LOG_FILE cd $SOURCE_DIR || { echo \u0026#34;$(date): ERROR: cannot enter $SOURCE_DIR\u0026#34; \u0026gt;\u0026gt; $LOG_FILE exit 1 } echo \u0026#34;$(date): fetching remote updates\u0026#34; \u0026gt;\u0026gt; $LOG_FILE git fetch origin \u0026gt;\u0026gt; $LOG_FILE 2\u0026gt;\u0026amp;1 echo \u0026#34;$(date): force sync with remote main branch\u0026#34; \u0026gt;\u0026gt; $LOG_FILE git reset --hard origin/main \u0026gt;\u0026gt; $LOG_FILE 2\u0026gt;\u0026amp;1 echo \u0026#34;$(date): updating submodules\u0026#34; \u0026gt;\u0026gt; $LOG_FILE git submodule update --init --recursive \u0026gt;\u0026gt; $LOG_FILE 2\u0026gt;\u0026amp;1 echo \u0026#34;$(date): generating static files\u0026#34; \u0026gt;\u0026gt; $LOG_FILE hugo --destination $WEB_DIR --minify -D \u0026gt;\u0026gt; $LOG_FILE 2\u0026gt;\u0026amp;1 echo \u0026#34;$(date): setting permissions\u0026#34; \u0026gt;\u0026gt; $LOG_FILE chmod -R 755 $WEB_DIR \u0026gt;\u0026gt; $LOG_FILE 2\u0026gt;\u0026amp;1 ","permalink":"https://gogo.anthony42.eu.org/posts/hugo-nginx/","summary":"\u003ch2 id=\"nginx-cfg\"\u003enginx cfg\u003c/h2\u003e\n\u003cpre tabindex=\"0\"\u003e\u003ccode\u003e location /webhook/ {\n        allow 140.82.112.0/20;\n        allow 192.30.252.0/22;\n        allow 185.199.108.0/22;\n        allow 127.0.0.1;\n        deny all;\n\n        proxy_pass http://127.0.0.1:9000/hooks/;\n        proxy_set_header Host $host;\n        proxy_set_header X-Real-IP $remote_addr;\n        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n        proxy_set_header X-Forwarded-Proto $scheme;\n        proxy_read_timeout 120s;\n        proxy_buffering off;\n    }\n\u003c/code\u003e\u003c/pre\u003e\u003cpre tabindex=\"0\"\u003e\u003ccode\u003e location ~* \\.(jpg|jpeg|png|gif|ico|css|js|svg|woff|woff2|ttf|eot|webp)$    {\n     expires 30d;\n     add_header Cache-Control \u0026#34;public, immutable\u0026#34;;\n     log_not_found off;\n     access_log off;\n }\n\n location ~* \\.(html|htm|xml|txt|json)$ {\n     expires 1h;\n     add_header Cache-Control \u0026#34;public\u0026#34;;\n }\n\n location ~ /\\. {\n     deny all;\n     access_log off;\n     log_not_found off;\n }\n\n location ~* \\.(sql|bak|backup|sh|log|ini|conf|yml|yaml|md)$ {\n     deny all;\n     return 404;\n }\n\u003c/code\u003e\u003c/pre\u003e\u003ch2 id=\"etcsystemdsystemwebhookservice\"\u003e/etc/systemd/system/webhook.service\u003c/h2\u003e\n\u003cpre tabindex=\"0\"\u003e\u003ccode\u003e[Unit]\nDescription=Webhook Service\nAfter=network.target\n\n[Service]\nType=simple\nUser=root\nGroup=root\nExecStart=/usr/local/bin/webhook -ip 127.0.0.1 -port 9000 -hooks /etc/webhook/hooks.json -verbose\nRestart=always\nRestartSec=5\n\n[Install]\nWantedBy=multi-user.target\n\u003c/code\u003e\u003c/pre\u003e\u003ch2 id=\"deploy\"\u003edeploy\u003c/h2\u003e\n\u003cpre tabindex=\"0\"\u003e\u003ccode\u003e#!/bin/bash\n\nSOURCE_DIR=\u0026#34;/home/anthony/blog-source\u0026#34;\nWEB_DIR=\u0026#34;/var/www/blog\u0026#34;\nLOG_FILE=\u0026#34;/var/log/webhook/deploy.log\u0026#34;\n\necho \u0026#34;$(date): ========== start deploy ==========\u0026#34; \u0026gt;\u0026gt; $LOG_FILE\n\ncd $SOURCE_DIR || {\n    echo \u0026#34;$(date): ERROR: cannot enter $SOURCE_DIR\u0026#34; \u0026gt;\u0026gt; $LOG_FILE\n    exit 1\n}\n\necho \u0026#34;$(date): fetching remote updates\u0026#34; \u0026gt;\u0026gt; $LOG_FILE\ngit fetch origin \u0026gt;\u0026gt; $LOG_FILE 2\u0026gt;\u0026amp;1\n\necho \u0026#34;$(date): force sync with remote main branch\u0026#34; \u0026gt;\u0026gt; $LOG_FILE\ngit reset --hard origin/main \u0026gt;\u0026gt; $LOG_FILE 2\u0026gt;\u0026amp;1\n\necho \u0026#34;$(date): updating submodules\u0026#34; \u0026gt;\u0026gt; $LOG_FILE\ngit submodule update --init --recursive \u0026gt;\u0026gt; $LOG_FILE 2\u0026gt;\u0026amp;1\n\necho \u0026#34;$(date): generating static files\u0026#34; \u0026gt;\u0026gt; $LOG_FILE\nhugo --destination $WEB_DIR --minify -D \u0026gt;\u0026gt; $LOG_FILE 2\u0026gt;\u0026amp;1\n\necho \u0026#34;$(date): setting permissions\u0026#34; \u0026gt;\u0026gt; $LOG_FILE\nchmod -R 755 $WEB_DIR \u0026gt;\u0026gt; $LOG_FILE 2\u0026gt;\u0026amp;1\n\u003c/code\u003e\u003c/pre\u003e","title":"Hugo Nginx"},{"content":"webhook status sudo systemctl daemon-reload sudo systemctl restart webhook sudo systemctl status webhook sudo netstat -tlnp | grep webhook webhook.service vi /etc/systemd/system/webhook.service deploy.sh vi /usr/local/bin/deploy.sh log tail -f /var/log/webhook/deploy.log ","permalink":"https://gogo.anthony42.eu.org/posts/webhook/","summary":"\u003ch1 id=\"webhook-status\"\u003ewebhook status\u003c/h1\u003e\n\u003cpre tabindex=\"0\"\u003e\u003ccode\u003esudo systemctl daemon-reload\n\u003c/code\u003e\u003c/pre\u003e\u003cpre tabindex=\"0\"\u003e\u003ccode\u003esudo systemctl restart webhook\n\u003c/code\u003e\u003c/pre\u003e\u003cpre tabindex=\"0\"\u003e\u003ccode\u003esudo systemctl status webhook\n\u003c/code\u003e\u003c/pre\u003e\u003cpre tabindex=\"0\"\u003e\u003ccode\u003esudo netstat -tlnp | grep webhook\n\u003c/code\u003e\u003c/pre\u003e\u003ch1 id=\"webhookservice\"\u003ewebhook.service\u003c/h1\u003e\n\u003cpre tabindex=\"0\"\u003e\u003ccode\u003evi /etc/systemd/system/webhook.service\n\u003c/code\u003e\u003c/pre\u003e\u003ch1 id=\"deploysh\"\u003edeploy.sh\u003c/h1\u003e\n\u003cpre tabindex=\"0\"\u003e\u003ccode\u003evi /usr/local/bin/deploy.sh\n\u003c/code\u003e\u003c/pre\u003e\u003ch1 id=\"log\"\u003elog\u003c/h1\u003e\n\u003cpre tabindex=\"0\"\u003e\u003ccode\u003etail -f /var/log/webhook/deploy.log\n\u003c/code\u003e\u003c/pre\u003e","title":"webhook"}]