Coder Social home page Coder Social logo

ndrkltsk / lobsters Goto Github PK

View Code? Open in Web Editor NEW

This project forked from gambe-ro/lobsters

0.0 1.0 0.0 2.57 MB

Computing-focused community centered around link aggregation and discussion

Home Page: https://gambe.ro

License: GNU Affero General Public License v3.0

Dockerfile 0.13% Ruby 53.67% JavaScript 16.99% CSS 6.33% HTML 21.98% Shell 0.89%

lobsters's Introduction

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 scripts/docker-run.sh:

    $ scripts/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: (?)

lobsters's People

Contributors

a-chernykh avatar abutler3 avatar akkartik avatar alanpca avatar amalrik avatar capacitorset avatar chobeat avatar crertel avatar derekprior avatar jcs avatar jdan avatar karjudev avatar kratacoa avatar mxswd avatar nyanpasu avatar oa414 avatar padi avatar pizzo00 avatar prayagverma avatar pushcx avatar rhysforyou avatar riggraz avatar rjsamson avatar rvoicilas avatar samhasler avatar sidevesh avatar srgpqt avatar srobuttiteraki avatar walle avatar wilkie avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.