- login to 'AWS Management Console' (https://aws.amazon.com/console/)
- from 'Services'(in navbar) choose 'EC2'
- from 'Create Instance' section, click on 'Launch Instance'
- then select 'AMI' (Amazon Machine Image), we will be using 'Ubuntu Server 16.04 LTS (HVM)' as example
- select 'Instance Type' as per your requirement
- then click 'Next:Configure Instance Details' to continue
change 'Configure Instance Details' or used as default settings
| .git | |
| .gitignore | |
| # Created by https://www.gitignore.io/api/git,ruby,rails,jetbrains+all | |
| # Edit at https://www.gitignore.io/?templates=git,ruby,rails,jetbrains+all | |
| ### Git ### | |
| # Created by git for backups. To disable backups in Git: | |
| # $ git config --global mergetool.keepBackup false | |
| *.orig |
| FROM ruby:2.6.5-alpine | |
| RUN apk add --update --no-cache bash build-base nodejs sqlite-dev tzdata postgresql-dev yarn | |
| RUN gem install bundler:2.1.4 | |
| WORKDIR /usr/src/app | |
| COPY package.json yarn.lock ./ | |
| RUN yarn install --check-files |
| Africa/Abidjan | |
| Africa/Accra | |
| Africa/Addis_Ababa | |
| Africa/Algiers | |
| Africa/Asmara | |
| Africa/Asmera | |
| Africa/Bamako | |
| Africa/Bangui | |
| Africa/Banjul | |
| Africa/Bissau |
There are times when you need to log off your Linux Desktop, and you want a process to run in the background. TMUX manages this very well.
For this example, let's suppose you're running a long running task like running rspecs on your project and
it is 5pm, and you need to go home.
| 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: |
| # /etc/systemd/system/foo.service | |
| [Unit] | |
| Description=Foo service | |
| Wants=nginx.service | |
| Requires=postgresql.service | |
| After=postgresql.service | |
| [Service] | |
| Type=simple | |
| User=foo |
If you're trying to install the postgresql gem pg and it is failing with the following error message:
Installing pg 1.2.3 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: ~/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/pg-1.2.3/ext
~/.rbenv/versions/3.0.0/bin/ruby -I ~/.rbenv/versions/3.0.0/lib/ruby/3.0.0 -r ./siteconf20210125-97201-pycpo.rb extconf.rb
Based on this blogpost.
Install with Homebrew:
$ brew install postgresql@14(The version number 14 needs to be explicitly stated. The @ mark designates a version number is specified. If you need an older version of postgres, use postgresql@13, for example.)
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: