Skip to content

CapacitorSet/lobsters

 
 

Repository files navigation

Gambe.ro

gambe.ro is a community of italian programmers built using lobste.rs software.

This code is forked from journalduhacker.net (code available here). Journalduhacker, in turn, is a fork of lobste.rs (code available here).

License

Licensed under the AGPLv3 license. See LICENSE for the full license.

Contributing

Please see the CONTRIBUTING file.

Setup

  • Install Docker.

  • Clone the repository:

    $ git clone https://github.com/gambe-ro/lobsters.git
    $ cd lobsters
  • Define the following environment variables in the file .env:

    • RAILS_ENV: the environment in which Ruby on Rails will run. It must be one of the following: development, test, production.
    • SECRET_KEY_BASE: a secret string used to verify the validity of cookies.
    • MYSQL_USER: the MariaDB username (for the user that gambe.ro will use).
    • MYSQL_PASSWORD: the MariaDB password.
    • MYSQL_ROOT_PASSWORD: the root password for MariaDB (used only for table initialization).
    • MYSQL_DATABASE: the MariaDB database name.
    • SMTP_USERNAME: the username for the SMTP server (whose address is hardcoded in config/initializers/email.rb).
    • SMTP_PASSWORD: the password for the SMTP server.
  • Apply some manual security tweaks:

    • If you are deploying gambe.ro, edit your .bashrc (or the equivalent for your shell) and add the following:
    export DOCKER_CONTENT_TRUST=1

    then run the next steps in a new shell.

    • If you are developing gambe.ro, remove read_only: true from the app container in docker-compose.yml.
  • Run deployment/docker-run.sh:

    $ deployment/docker-run.sh

    This command will provision two containers: one for the Ruby on Rails server and one for the MariaDB database.

  • You should now be able to view the website at 172.20.0.2:8080 (you can change this address from the docker-compose.yml file). Moreover, you should be able to login with the test account (password is test).

When in production, don't forget to copy maintenance/ somewhere and make Nginx point to it (see nginx.conf).

Additional setup steps

  • Define your site's name and default domain, which are used in various places, in a config/initializers/production.rb or similar file:

    class << Rails.application
      def domain
        "example.com"
      end
    
      def name
        "Example News"
      end
    end
    
    Rails.application.routes.default_url_options[:host] = Rails.application.domain
  • Put your site's custom CSS in app/assets/stylesheets/local.

  • In production, set up crontab or another scheduler to run regular jobs:

    */20 * * * * cd /path/to/gambero && env RAILS_ENV=production bundle exec rake ts:index > /dev/null

Moderation

On-site tasks are carried out directly on the website. Console tasks are carried out through the Ruby on Rails console in production. To start the Rails console: rails c. To start the Rails console and rollback on exit: rails c --sandbox.

On-site tasks

Edit/Delete a story

By clicking the 'edit' button under the story title you can:

  • Delete the story
  • Edit the URL
  • Edit the title
  • Add or remove tags
  • Edit the body text
  • Merge the story into another

Delete a comment

Click the 'delete' button next to it.

Attach a moderation note to a user

Inside a user profile page, you can write moderation notes for that particular user. Only moderators can see them.

Disable invites for a user

Inside a user profile page, click the 'Disable Invites' button at the bottom. You will be able to re-enable invites by clicking on 'Enable Invites'.

Ban a user

Inside a user profile page, click the 'Ban' button at the bottom. You must provide a reason. You will be able to unban the user by clicking on 'Unban'.

Read the latest 10 moderation notes and moderations applied to a user

You can see them inside a user profile page. To see more than 10, you need to use the console.

Manage hats requests

Go to /hats/requests.

Console tasks

A typical command to add a resource is:

name_of_resource.create(attribute1: value1, attribute2: value2, ...)

To edit a resource first assign it to a variable, edit it and then save:

story = Story.find_by(short_id: story_short_id)
story.attribute = new_attribute_value
story.save()

To delete a resource (please see difference between delete and destroy):

story = Story.find_by(short_id: story_short_id)
story.delete() # or story.destroy()

Note: all resources can be added, edited and deleted through the console. However, it will be usually used in the following cases:

Add/Edit/Disable tag

Available attributes:

  • tag: name of the tag
  • description: description of the tag
  • privileged: if set to true, only moderators can post stories with this tag
  • is_media: (?)
  • inactive: if set to true, users cannot post stories with this tag anymore
  • hotness_mod: (?)

About

Computing-focused community centered around link aggregation and discussion

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 52.7%
  • HTML 27.8%
  • JavaScript 16.9%
  • Shell 1.3%
  • Other 1.3%