New Ruby on Rails app
New Rails app attempt number 2
- Install Ruby
- Install Rails gem (or check if you have the latest version)
- rails new fwcheck –database=postgresql
-
apt install postgresql postgresql-contrib libpq-dev
- Postgres in Docker:
set username and password in docker-compose
run ‘export DATABASE_URL=postgres://user:pass@127.0.0.1/’
version: ‘3.7’
services: db: image: postgres:15 restart: always ports: - 0.0.0.0:5432:5432 environment: POSTGRES_PASSWORD: example volumes: - ./_PGDATA:/var/lib/postgresql/data
- sudo -u postgres createuser -s fwcheck -P
OR
CREATE USER aike WITH PASSWORD '123';
ALTER ROLE aike CREATEROLE SUPERUSER CREATEDB;
- echo ‘export APPNAME_DATABASE_PASSWORD=”PostgreSQL_Role_Password”’ » ~/.bashrc
- source ~/.bashrc
- configure username and password for dev in config/database.yaml host: localhost username: me password: <%= ENV[‘APPNAME_DATABASE_PASSWORD’] %>
- Install Devise
- bundle add administrate
- rails g scaffold Address user:references ip:string name:string
- rails g scaffold Result address:references port:integer status:string scanned_at:datetime protocol:string tls:boolean
Kamal deploy
- bundle add kamal
- kamal init
- assume ssl! not force
On target host: mkdir -p /opt/letsencrypt && touch /opt/letsencrypt/acme.json && chmod 600 /opt/letsencrypt/acme.json docker network create -d bridge private