Skip to content

Instantly share code, notes, and snippets.

View my-very-own-account's full-sized avatar

my-very-own-account

View GitHub Profile
I, [2021-04-20T18:01:08.431631 #96522] INFO -- : [835dadc6-0e9a-4d4b-b232-1b81d03bd5ff] Started GET "/" for 89.8.98.176 at 2021-04-20 18:01:08 +0000
I, [2021-04-20T18:01:08.443897 #96522] INFO -- : [835dadc6-0e9a-4d4b-b232-1b81d03bd5ff] Processing by Spree::HomeController#index as HTML
I, [2021-04-20T18:01:08.559241 #96522] INFO -- : [835dadc6-0e9a-4d4b-b232-1b81d03bd5ff] Rendered /home/apps/.gem/bundler/gems/solidus-e878076f2ed6/frontend/app/views/spree/home/index.html.erb within spree/layouts/spree_application (Duration: 7.8ms | Allocations: 1362)
I, [2021-04-20T18:01:08.559921 #96522] INFO -- : [835dadc6-0e9a-4d4b-b232-1b81d03bd5ff] Rendered layout /home/apps/.gem/bundler/gems/solidus-e878076f2ed6/frontend/app/views/spree/layouts/spree_application.html.erb (Duration: 8.7ms | Allocations: 1396)
I, [2021-04-20T18:01:08.560931 #96522] INFO -- : [835dadc6-0e9a-4d4b-b232-1b81d03bd5ff] Completed 500 Internal Server Error in 117ms (ActiveRecord: 8.8ms | Allocations: 7831)
F, [2021-04-20T18:01:08.565022 #

/etc/rc.d/example_app_startup_script

#!/bin/ksh

app="example_app_startup_script"

script_name="$0"
script_full_path=$(dirname "$0")

daemon="$script_full_path/__rails_helper"

OpenBSD relayd/httpd Ruby on Rails

Big thanks to srfsh

/etc/relayd.conf

egress="[REDACTED IP]"

table <appie1> { 127.0.0.1 }
appie1_port="49195"

table <appie2> { 127.0.0.1 }

relayd (OpenBSD 6.8), Rails 6 and Let's Encrypt

CURRENT RESULT

When visiting http://myapp1.com we're redirected to https://www.myapp1.com/ (as expected), but with Secure Connection Failed. An error occurred during a connection to www.myapp1.com. PR_CONNECT_RESET_ERROR. PF is disabled. acme-client -v myapp1.com runs successfully. httpd is set up only to deal with ACME requests. nsd runs fine, and permissions for the keys have been set to chmod 750 /etc/ssl/private && chown apps:wheel /etc/ssl/private/*.key /etc/ssl/*.crt. Below you'll find:

  • /etc/relayd.conf
  • /etc/acme-client.conf
  • /etc/httpd.conf
  • /home/myapp/config/puma.rb
  • rcctl -d start myapp1

httpd.conf

localhost="lo0"

acme_challenge_port="4001"
https_redirect_port="4002"
static_sites_port="8080"

server "*" {
  listen on $localhost port $acme_challenge

/home/myapp/config/puma.rb

#!/usr/bin/env puma

app = "myapp"

ssl_bind "127.0.0.1", "8001", {
  key: "/etc/ssl/private/#{app}.key",
  cert: "/etc/ssl/#{app}.crt",
  no_tlsv1: true,

/var/www/logs/access.log

Going to http:

* 127.0.0.1 - - [26/Dec/2020:16:32:52 +0000] "GET / HTTP/1.1" 403 0

Going to https:

Secure Connection Failed (Firefox - unable to find anything in the logs)
module Spree
  module ShoppingCartHelper
    def shopping_cart_trigger(text = nil)
      text = text ? h(text) : t("spree.cart")

      if current_order.nil? || current_order.item_count.zero?
        text = "#{ text } " + content_tag(:span, "0", class: "count")
      else
 text = "#{ text } " + content_tag(:span, current_order.item_count, class: "count")
% bundle
Fetching gem metadata from https://rubygems.org/............
Resolving dependencies...
Bundler could not find compatible versions for gem "solidus":
In snapshot (Gemfile.lock):
solidus (= 2.11.2)
In Gemfile:
solidus

Trying to get Rails and Webpacker up and running but keep running into this problem:

Sometimes I get:

[4/4] Building fresh packages...
[1/3] ⠂ node-sass
[2/3] ⠂ core-js
error /home/dev/myapp/node_modules/node-sass: Command failed.
Exit code: 127
Command: node scripts/install.js