Peter Naur's classic 1985 essay "Programming as Theory Building" argues that a program is not its source code. A program is a shared mental construct (he uses the word theory) that lives in the minds of the people who work on it. If you lose the people, you lose the program. The code is merely a written representation of the program, and it's lossy, so you can't reconstruct
| # Rails production setup via SQLite3 made durable by https://litestream.io/ | |
| # Copy this to Dockerfile on a fresh rails app. Deploy to fly.io or any other container engine. | |
| # | |
| # try locally: docker build . -t rails && docker run -p3000:3000 -it rails | |
| # | |
| # in production you might want to map /data to somewhere on the host, | |
| # but you don't have to! | |
| # | |
| FROM ruby:3.0.2 |
| # for an example of a suggested `locals_without_parens`, see z_locals_without_parens.exs | |
| # parsing and expanding a formatter.exs file would be a good route too | |
| opts = [sourceror_opts: [locals_without_parens: [...], line_length: 122]] | |
| for transformation <- [&PipeChainStart.run/1, &SinglePipe.run/1] do | |
| ProjTraversal.transform("../my_codebase/", transformation, opts) | |
| end |
| /* | |
| Replace "your_schema" with whatever schema is appropriate in your environment. | |
| It is possible to use "public"... but you shouldn't! | |
| */ | |
| /* | |
| Function to stamp a "modified" timestamp. Adjust the name to suit your environment, | |
| but that name is hard-coded so it is assumed that you only use _one_ such name. |
| defmodule MyMacro do | |
| defmacro @{name, _meta, [arg]} do | |
| IO.inspect "Your #{name} is a #{arg}" | |
| end | |
| defmacro __using__(_) do | |
| quote do | |
| import Kernel, except: [@: 1] | |
| import unquote(__MODULE__) | |
| end |
| defmodule HeroiconWithSurface do | |
| @moduledoc """ | |
| This assumes https://github.com/tailwindlabs/heroicons has been cloned as a submodule to svgs/heroicons | |
| Examples: | |
| <#HeroiconWithSurface variant="outline" icon="phone" class="w-5 h-5" /> | |
| <%= HeroiconWithSurface.svg({"outline", "phone"}, class: "w-5 h-5") %> | |
| """ | |
| use SvgIcons, |
| Mute these words in your settings here: https://twitter.com/settings/muted_keywords | |
| ActivityTweet | |
| generic_activity_highlights | |
| generic_activity_momentsbreaking | |
| RankedOrganicTweet | |
| suggest_activity | |
| suggest_activity_feed | |
| suggest_activity_highlights | |
| suggest_activity_tweet |
| name: Elixir CI | |
| on: push | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| container: |
TLDR: JWTs should not be used for keeping your user logged in. They are not designed for this purpose, they are not secure, and there is a much better tool which is designed for it: regular cookie sessions.
If you've got a bit of time to watch a presentation on it, I highly recommend this talk: https://www.youtube.com/watch?v=pYeekwv3vC4 (Note that other topics are largely skimmed over, such as CSRF protection. You should learn about other topics from other sources. Also note that "valid" usecases for JWTs at the end of the video can also be easily handled by other, better, and more secure tools. Specifically, PASETO.)
A related topic: Don't use localStorage (or sessionStorage) for authentication credentials, including JWT tokens: https://www.rdegges.com/2018/please-stop-using-local-storage/
The reason to avoid JWTs comes down to a couple different points:
- The JWT specification is specifically designed only for very short-live tokens (~5 minute or less). Sessions
I got to here after spending hours trying to deploy to an Elastic Beanstalk instance via CircleCi 2.0 so I thought I'd write up what worked for me to hopefully help others. Shout out to RobertoSchneiders who's steps for getting it to work with CircleCi 1.0 were my starting point.
For the record, I'm not the most server-savvy of developers so there may be a better way of doing this.