Skip to content

Instantly share code, notes, and snippets.

View viezel's full-sized avatar

Mads Møller Schrøder viezel

View GitHub Profile
@viezel
viezel / charging_off.yml
Created March 6, 2023 08:22
Tesla charging automation in Home Assistant
alias: "EV Charging OFF"
description: ""
trigger:
- platform: numeric_state
entity_id: sensor.solar_realtime_power
for:
hours: 0
minutes: 1
seconds: 0
below: 1
@viezel
viezel / nuke-config.yml
Created August 5, 2022 18:21
Delete all resources in an AWS account
regions:
- eu-west-1
- global
account-blocklist:
- 1234567890
accounts:
"888222333444": {} # your account id
@viezel
viezel / Swoole-http-server-on-forge.md
Created April 9, 2021 13:57
Swoole http server on Laravel Forge

Quickly get Octane running on Laravel Forge

  • Spin up a new App server, choose PHP 8
  • SSH into it and run sudo -i to become root
  • Run pecl install swoole and enable what you need. (I disabled curl as it did not work for me)
  • Add a new site to your server and use git to pull in your Laravel project that has Octane installed.
  • Go to "Network" within the overall server settings
  • Add new Firewall rule
    • name: Swoole
  • port: 9501
@viezel
viezel / octane-on-forge.md
Last active December 16, 2023 21:57
Quickly get Octane running on Laravel Forge

Quickly get Octane running on Laravel Forge

  1. Spin up a new App server, choose PHP 8
  2. SSH into it and run sudo -i to become root
  3. Run pecl install swoole and enable what you need. (I disabled curl as it did not work for me)
  4. Add a new Site to your server and use git to pull in your Laravel project that has Octane installed.
  5. Point your DNS to your new site
  6. Enable SSL using Lets Encrypt
  7. Change your new Sites Nginx settings to (assuing your site is named octane.example.com):
@viezel
viezel / test-octane.md
Last active April 22, 2023 00:47
Quick Laravel Octane test - UPDATED

Intro

I wanted to quickly take Laravel Octane beta for a spin, as we have been using Swoole for some time and wanted to see how official support performs vs what we have.

Test 2: Forge server

Next test is more real world as we now have a web server and database server within a VPC.

Using Laravel Forge

@viezel
viezel / Readme.md
Last active June 22, 2022 12:30
Gitlab Docker in Docker build image and deploy to AWS ECR

Gitlab CI: Build docker images and deploy to AWS ECR

It takes some tries to get Gitlab CI to build and deploy to AWS, since you need to use docker in docker (dind). Here is what works for me.

Notice: Gitlab runner

  • runner must be privileged
  • see changes to runner volumes
@viezel
viezel / Readme.md
Last active May 30, 2023 22:51
Invoker Docker support

Use Invoker with Docker

composer require viezel/dock --dev
php artisan dock:install

Now publish the docker-compose

@viezel
viezel / log query
Created April 22, 2020 08:05
Laravel Vapor - Cloudwatch insights logs
fields @timestamp, @message
# Lambda
| filter @message not like "START RequestId"
| filter @message not like "END RequestId"
| filter @message not like "REPORT RequestId"
# FPM
| filter @message not like "NOTICE: ready to handle connections"
| filter @message not like "NOTICE: fpm is running"
@viezel
viezel / databases sizes.sql
Created January 29, 2020 12:21
Get sizes of all databases in server
SELECT
table_schema 'Database Name',
SUM(data_length + index_length) 'Size in Bytes',
ROUND(SUM(data_length + index_length) / 1024 / 1024, 2) 'Size in MiB'
FROM information_schema.tables
GROUP BY table_schema;
@viezel
viezel / bug.md
Last active January 8, 2020 13:30
Possible bug: Config persists between queue jobs ?

Possible bug: Config persists between queue jobs ?

I think i found a bug in handling of queue jobs in Laravel. If I run laravel queue jobs with config cached in laravel, then runtime configs persists between jobs.

Expected result: Second job does not know of runtime config.

How to reproduce