Apple MacBook Pro M1, 32 GB, Ventura 13.2
Documentation based on comments in this Github Elasticsearch issue.
Install Homebrew
Apple MacBook Pro M1, 32 GB, Ventura 13.2
Documentation based on comments in this Github Elasticsearch issue.
These are my notes from deploying a boilerplate Rails app to AWS Lambda (yeah, you read that right) using Lamby. Basically this is me going through the Quick Start guide.
Questions/comments: https://twitter.com/heyjoshwood
This is just some code I recently used in my development application in order to add token-based authentication for my api-only rails app. The api-client was to be consumed by a mobile application, so I needed an authentication solution that would keep the user logged in indefinetly and the only way to do this was either using refresh tokens or sliding sessions.
I also needed a way to both blacklist and whitelist tokens based on a unique identifier (jti)
Before trying it out DIY, I considered using:
# app/helpers/application_helper.rb | |
module ApplicationHelper | |
# active_storage_item could be a blob or variant object | |
def proxy_url(active_storage_item, options = {}) | |
options.merge!(host: ENV['ASSETS_HOST']) if ENV['ASSETS_HOST'].present? | |
# proxy: 'true' allows you to stil have the original functionality while | |
# being able to proxy through a CDN. You've got to ensure that your CDN | |
# forwards this param otherwise active storage will always do the default | |
# behavior which is a redirect to the service. |
FROM ruby:2.6.3-slim | |
RUN apt-get update && apt-get install -qq -y --no-install-recommends build-essential libpq-dev libsqlite3-dev curl imagemagick nodejs | |
RUN groupadd -r -g 1000 docker && \ | |
useradd -r --create-home -u 1000 -g docker docker | |
WORKDIR /my-app | |
COPY Gemfile /my-app/Gemfile |
This blogpost shows how to setup Rails 6 with Bootstrap 4.
This snippet shows a somehow different and less customized approach.
$ rails new rails6-bootstrap4
$ bundle --binstubs
$ yarn add bootstrap jquery popper.js expose-loader
# .ebextensions/01_install_yarn.config | |
files: | |
'/opt/elasticbeanstalk/hooks/appdeploy/pre/49install_yarn.sh' : | |
mode: '000755' | |
owner: root | |
group: root | |
content: | | |
#!/usr/bin/env bash | |
set -euxo pipefail |
FROM ruby:2.3.1 | |
# Install dependencies | |
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs | |
# Set an environment variable where the Rails app is installed to inside of Docker image: | |
ENV RAILS_ROOT /var/www/app_name | |
RUN mkdir -p $RAILS_ROOT | |
# Set working directory, where the commands will be ran: |
DROP TABLE if exists d_date; | |
CREATE TABLE d_date | |
( | |
date_dim_id INT NOT NULL, | |
date_actual DATE NOT NULL, | |
epoch BIGINT NOT NULL, | |
day_suffix VARCHAR(4) NOT NULL, | |
day_name VARCHAR(9) NOT NULL, | |
day_of_week INT NOT NULL, |
#app/views/businesses/_form.html.erb | |
<%= form_with(model: business, scope: :business, local: true, :html => {multipart: true}) do |form| %> | |
<div class="row"> | |
<div class="col-md-12"> | |
<%= form.file_field :logo_image, id: :business_logo_image %> | |
<%= form.label :logo_image, class: 'upload' do %> | |
<i class="material-icons">file_upload</i> | |
<span>Choose image</span> |