Skip to content

Instantly share code, notes, and snippets.

@wmnnd
wmnnd / dprint-check.sh
Created January 17, 2023 20:19
Use dprint check in Alpine-based CI pipeline
export DPRINT_INSTALL="$HOME/.dprint"
mkdir -p "$DPRINT_INSTALL/bin"
curl -fsSL https://github.com/dprint/dprint/releases/download/0.34.1/dprint-x86_64-unknown-linux-musl.zip -o "$DPRINT_INSTALL/bin/dprint.zip"
unzip "$DPRINT_INSTALL/bin/dprint.zip" -d "$DPRINT_INSTALL/bin/"
chmod +x "$DPRINT_INSTALL/bin/dprint"
export PATH="$PATH:$DPRINT_INSTALL/bin"
dprint check
@wmnnd
wmnnd / fetch_logs.sh
Created December 7, 2022 14:28
Fetch fly-log-shipper logs from S3
#/bin/bash
# You need to have the aws CLI installed and configured.
# Set the S3_BUCKET variable before using.
S3_BUCKET="your-s3-log-bucket"
echo "Fetching logs from S3 ..."
aws s3 sync "s3://$S3_BUCKET" ./aws_logs
@wmnnd
wmnnd / force-https.toml
Created March 11, 2020 00:05
Traefik configuration for an HTTPS redirect middleware/router
[http.routers]
[http.routers.force-https]
entryPoints = ["http"]
middlewares = ["force-https"]
rule = "HostRegexp(`{any:.+}`)"
service = "noop"
[http.middlewares]
[http.middlewares.force-https.redirectScheme]
scheme = "https"
@wmnnd
wmnnd / traefik.toml
Last active February 14, 2024 00:49
Traefik configuration
[log]
level = "WARN"
[providers]
[providers.docker]
exposedByDefault = false
[providers.file]
directory = "/etc/traefik/dynamic"
[entryPoints]
@wmnnd
wmnnd / docker-compose.yml
Last active February 14, 2024 00:55
docker-compose with Traefik labels
version: '3.4'
services:
# ...
my-app:
image: my-app:latest
labels:
- 'traefik.enable=true'
- 'traefik.http.routers.my-app.rule=Host(`example.com`)'
- 'traefik.http.routers.my-app.tls=true'
- 'traefik.http.routers.my-app.tls.certresolver=lets-encrypt'
@wmnnd
wmnnd / docker-compose.yml
Last active February 14, 2024 00:51
docker-compose with Traefik
version: '3.4'
services:
traefik:
image: traefik:2.1
restart: always
ports:
- '80:80'
- '443:443'
volumes:
- ./traefik:/etc/traefik
@wmnnd
wmnnd / Dockerfile
Last active June 19, 2019 14:59
Elixir Dockerfile Boilerplate
#===========
#Build Stage
#===========
FROM bitwalker/alpine-elixir:1.5 as build
#Copy the source folder into the Docker image
COPY . .
#Install dependencies and build Release
RUN export MIX_ENV=prod && \
require 'opal'
require 'sinatra'
$OPAL_APP_PATH = 'app'
map "/__opal_source_maps__" do
opal = Opal::Server.new {|s|
s.append_path $OPAL_APP_PATH
s.main = 'application'
}