Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Bookmarks
  • Search
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

Cloudron Forum

Apps - Status | Demo | Docs | Install
  1. Cloudron Forum
  2. Dawarich
  3. How to use the Rails Console

How to use the Rails Console

Scheduled Pinned Locked Moved Solved Dawarich
5 Posts 3 Posters 48 Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • imc67I Offline
    imc67I Offline
    imc67
    translator
    wrote last edited by
    #1

    According to https://dawarich.app/docs/FAQ I want to do some datapoint cleaning:

    1. https://dawarich.app/docs/FAQ#how-to-enter-dawarich-console enter the Rails Console, as the app terminal is already in docker I did: bin/rails console and entered "something"
    /app/code# bin/rails console
    [dotenv] Set DATABASE_HOST, DATABASE_USERNAME, DATABASE_PASSWORD, DATABASE_NAME, DATABASE_PORT, REDIS_URL, and OBJC_DISABLE_INITIALIZE_FORK_SAFETY
    [dotenv] Loaded .env.development
    OIDC: Not configured (missing OIDC_CLIENT_ID or OIDC_CLIENT_SECRET)
    Loading development environment (Rails 8.0.3)
    [1] pry(main)> 
    
    1. there I did https://dawarich.app/docs/FAQ#my-distance-is-off-how-can-i-fix-it:
    [1] pry(main)> points = Point.where(latitude: 0, longitude: 0)
    ActiveRecord::ConnectionNotEstablished: connection to server at "::1", port 5432 failed: Connection refused (ActiveRecord::ConnectionNotEstablished)
            Is the server running on that host and accepting TCP/IP connections?
    connection to server at "127.0.0.1", port 5432 failed: Connection refused
            Is the server running on that host and accepting TCP/IP connections?
    
    from /app/code/vendor/bundle/ruby/3.4.0/gems/activerecord-8.0.3/lib/active_record/connection_adapters/postgresql_adapter.rb:69:in 'ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.new_client'
    Caused by PG::ConnectionBad: connection to server at "::1", port 5432 failed: Connection refused
            Is the server running on that host and accepting TCP/IP connections?
    connection to server at "127.0.0.1", port 5432 failed: Connection refused
            Is the server running on that host and accepting TCP/IP connections?
    
    from /app/code/vendor/bundle/ruby/3.4.0/gems/pg-1.6.2-x86_64-linux/lib/pg/connection.rb:751:in 'PG::Connection::Pollable#polling_loop'
    [2] pry(main)>
    

    Now the question is how to get this working? There are many more "tools" via this Console but it has to work in the first place 😉

    1 Reply Last reply
    0
    • nebulonN Away
      nebulonN Away
      nebulon
      Staff
      wrote last edited by
      #2

      You probably have to run rails via bundle exec rails ... like the start.sh script does?

      imc67I 1 Reply Last reply
      0
      • nebulonN nebulon

        You probably have to run rails via bundle exec rails ... like the start.sh script does?

        imc67I Offline
        imc67I Offline
        imc67
        translator
        wrote last edited by
        #3

        @nebulon same results, tried console and dbconsole

        root@8c0ca5cc-f129-4fb3-9de3-4b308caacb38:/app/code# bundle exec rails
        Usage:
          bin/rails COMMAND [options]
        
        You must specify a command. The most common commands are:
        
          generate     Generate new code (short-cut alias: "g")
          console      Start the Rails console (short-cut alias: "c")
          server       Start the Rails server (short-cut alias: "s")
          test         Run tests except system tests (short-cut alias: "t")
          test:system  Run system tests
          dbconsole    Start a console for the database specified in config/database.yml
                       (short-cut alias: "db")
          plugin new   Create a new Rails railtie or engine
        
        All commands can be run with -h (or --help) for more information.
        
        root@8c0ca5cc-f129-4fb3-9de3-4b308caacb38:/app/code# bundle exec rails console
        [dotenv] Set DATABASE_HOST, DATABASE_USERNAME, DATABASE_PASSWORD, DATABASE_NAME, DATABASE_PORT, REDIS_URL, and OBJC_DISABLE_INITIALIZE_FORK_SAFETY
        [dotenv] Loaded .env.development
        OIDC: Not configured (missing OIDC_CLIENT_ID or OIDC_CLIENT_SECRET)
        Loading development environment (Rails 8.0.3)
        [1] pry(main)> points = Point.where(latitude: 0, longitude: 0)
        ActiveRecord::ConnectionNotEstablished: connection to server at "::1", port 5432 failed: Connection refused (ActiveRecord::ConnectionNotEstablished)
                Is the server running on that host and accepting TCP/IP connections?
        connection to server at "127.0.0.1", port 5432 failed: Connection refused
                Is the server running on that host and accepting TCP/IP connections?
        
        from /app/code/vendor/bundle/ruby/3.4.0/gems/activerecord-8.0.3/lib/active_record/connection_adapters/postgresql_adapter.rb:69:in 'ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.new_client'
        Caused by PG::ConnectionBad: connection to server at "::1", port 5432 failed: Connection refused
                Is the server running on that host and accepting TCP/IP connections?
        connection to server at "127.0.0.1", port 5432 failed: Connection refused
                Is the server running on that host and accepting TCP/IP connections?
        
        from /app/code/vendor/bundle/ruby/3.4.0/gems/pg-1.6.2-x86_64-linux/lib/pg/connection.rb:751:in 'PG::Connection::Pollable#polling_loop'
        [2] pry(main)> exit
        
        
        root@8c0ca5cc-f129-4fb3-9de3-4b308caacb38:/app/code# bundle exec rails dbconsole
        [dotenv] Set DATABASE_HOST, DATABASE_USERNAME, DATABASE_PASSWORD, DATABASE_NAME, DATABASE_PORT, REDIS_URL, and OBJC_DISABLE_INITIALIZE_FORK_SAFETY
        [dotenv] Loaded .env.development
        OIDC: Not configured (missing OIDC_CLIENT_ID or OIDC_CLIENT_SECRET)
        psql: error: connection to server at "localhost" (::1), port 5432 failed: Connection refused
                Is the server running on that host and accepting TCP/IP connections?
        connection to server at "localhost" (127.0.0.1), port 5432 failed: Connection refused
                Is the server running on that host and accepting TCP/IP connections?
        root@8c0ca5cc-f129-4fb3-9de3-4b308caacb38:/app/code# 
        
        1 Reply Last reply
        0
        • jamesJ Online
          jamesJ Online
          james
          Staff
          wrote last edited by
          #4

          Hello @imc67
          We have added a doc section for the rails console.
          https://docs.cloudron.io/packages/dawarich/#rails-console

          imc67I 1 Reply Last reply
          1
          • jamesJ james

            Hello @imc67
            We have added a doc section for the rails console.
            https://docs.cloudron.io/packages/dawarich/#rails-console

            imc67I Offline
            imc67I Offline
            imc67
            translator
            wrote last edited by
            #5

            @james wow, this was the trick! Thanks!!🙏

            1 Reply Last reply
            0
            • imc67I imc67 has marked this topic as solved
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Bookmarks
            • Search