Skip to content

kir-dev/warp-next

Repository files navigation

Warp-next

The Kir-Dev organization has history with image hosting under the project name 'warp-drive'. This new project aims to fulfill the same purpose: easy Rails application for internal image hosting, mostly needed by the blog-next project.

Felhasználás:

  • Köröket kĂ©rĂ©sre kĂ©szĂ­t a Warp ĂĽzemeltetĹ‘je.
  • Minden Ăşjonnan belĂ©pĹ‘ szemĂ©lynek jelentkeznie kell egy körbe a nyitĂł oldalon. A kör adminjai elfogadják a belĂ©pni kĂ­vánĂł szemĂ©lyt, ezután tud albumokat rendezni Ă©s használni.

Tech

Development notes

As of rails 6.1.4 you can make ActiveStorage blobs private, by making your own authenticated controllers, but no way of wiring it in the framework is provided. To tackle this there is a little extension code, that opens the original controllers and injects authorization code. If rails version is bumped this could brake. In this case remove the extension loader from config/application.rb

Tech stack

  • Ruby on Rails (ActiveStorage as the image storage)
  • Bulma
  • PhotoSwipe
  • PostgreSQL
  • Docker

Local setup

note: This repo uses Ruby 3.0.2, if you use rbenv, install it with rbenv install 3.0.2.

Create database user

sudo su postgres # log in to postgres user
createuser -P -s warp # create a database user for the project
# Now the `createuser` command will prompt for a password. Make it `CHANGE-ME`.
exit # change back to your normal user

Set up the database

rails db:setup # setup the database
rails s # serve application

Docker database

You might be wanting to use docker for containerizing the postgres DBMS instead of installing one yourself:

docker volume create --name=warp_db # create the persistent database volume
docker-compose --file docker-compose.dev.yml up --build -d # run ONLY the database container

After creating the database container you have to set up the database from the console (see above).

AuthSCH setup

  1. Copy .env.example as .env:
    cp .env.example .env
  2. Navigate to Developer console on the AuthSCH admin page.
  3. Create a new OAuth client, set the callback url to http://localhost:3000/auth/oauth/callback
  4. Copy the received client id and client secret into the .env file, and restart your server app.

Disclaimer

  • No testing yet
  • When deployed, db and web container's warp-next/storage directory (with the images) should be saved sometimes