Giter Club home page Giter Club logo

abitrolly / software-o-o Goto Github PK

View Code? Open in Web Editor NEW

This project forked from opensuse/software-o-o

0.0 2.0 0.0 58.93 MB

The site behind https://software.opensuse.org. It is the default web interface to download openSUSE distributions and to search for OBS packages. Packaged at https://build.opensuse.org/project/show/openSUSE:infrastructure:software.opensuse.org

Home Page: https://software.opensuse.org/

License: GNU General Public License v2.0

Ruby 40.61% JavaScript 3.81% CSS 0.96% HTML 48.80% Dockerfile 0.31% Makefile 0.31% SCSS 5.19%

software-o-o's Introduction

software.opensuse.org

Build StatusGitter chat

Ruby on Rails application powering https://software.opensuse.org

We hope you'll get involved! Read our Contributors' Guide for details.

Please note that deployments are currently not fully automated. So please note that commits and accepted pull-requests might not be visible on the production website software.opensuse.org for weeks or in exceptional cases for months until the deployment was triggered manually.

Installing dependencies in a (open)SUSE system

If you are an openSUSE user, you can configure your environment with:

zypper ref
zypper in ruby ruby-devel 'rubygem(bundler)' nodejs gcc gcc-c++ make libxml2-devel libxslt-devel

We recommend the usage of Ruby 2.5 or higher for the development (openSUSE Leap 15.2 and Tumbleweed satisfy this requirement). You can find more information about Ruby development and packaging on openSUSE distributions in the openSUSE Ruby page.

Running the application locally

Just for running it in development mode. If you are playing to deploy it in a server, please apply good Ruby on Rails practices (like generating your own keys for secrets.yml).

git clone https://github.com/openSUSE/software-o-o.git
cd software-o-o

bundle package
bundle exec rails s

Enjoy your software.opensuse.org clone at http://127.0.0.1:3000/

You can also run the unit tests locally using the command:

bundle exec rails test

and also the System Tests that will simulate user interaction using a headless browser:

bundle exec rails test:system

IMPORTANT: For the System Tests, the project is configured to use Firefox Headless Mode feature, available on:

  • Linux: Firefox 55 or higher;
  • Windows/Mac: Firefox 56 or higher.

See more here.

Instrumentation on development

By default in non-production environments, the prometheus instrumentation is disabled. You can enable it by passing INSTRUMENTATION=true environment variable when starting the application:

INSTRUMENTATION=true bundle exec rails s

When doing this, you need to start the prometheus_exporter process separately (otherwise you will observe a lot of warnings in the log as the instrumentation code will try to connect to the collector process). You can do so with this command:

bundle exec prometheus_exporter

After this the prometheus metrics will be exported under http://localhost:9394/metrics.

Updaing opensuse-theme-chameleon assets

git submodule init
git submodule update
make

After running the above commands, run RAILS_ENV=production rails assets:precompile and you should see the new assets.

Running the application in production

The application will take the following environment variables:

  • SECRET_KEY_BASE: See Encrypted Session Storage in Rails documentation.
  • API_USERNAME and API_PASSWORD: Credentials to the Open Build Service API end-point
    • These can be replaced with OPENSUSE_COOKIE if you have admin access to the Open Build Service instance.
  • RAILS_ENV

Puma will honor other variables too:

  • WEB_CONCURRENCY
  • RAILS_MAX_THREADS
  • PORT
  • RACK_ENV
  • SOFTWARE_O_O_RBTRACE

In production, prometheus instrumentation is enabled and prometheus_exporter process must be started.

Debugging

  • If SOFTWARE_O_O_RBTRACE is set, you can use rbtrace to debug the application.

Memcache

memcache should be running. It seems to be hardcoded in environments/production.rb to localhost:11211. This probably needs to be fixed, as the dalli gem, automatically uses MEMCACHE_SERVERS env variable or 127.0.0.1:11211 as default.

PaaS

If you plan to run the application on PaaS, make sure you set all the above variables correctly.

Official instance

The official instance is deployed using an rpm package. The rpm package bundles all the required gems.

There is a software_opensuse_org.service you can control via systemd.

The systemd service will read the variables described above from /etc/software_opensuse_org.conf in the form of an EnvironmentFile:

VAR1=value1
VAR2=value2
...

Development environment using Vagrant

There is also a Vagrant setup to create our development environment. All the tools needed for this are available for Linux, MacOS and Windows.

  1. Install Vagrant and docker. Both tools support Linux, MacOS and Windows.

  2. Clone this code repository:

    git clone --recurse-submodules [email protected]:openSUSE/software-o-o.git
    
  3. Build your Vagrant box:

    vagrant up
    
  4. Attach to your new development box:

    docker attach software_web
    
  5. Install gems:

    bundle install
    
  6. Start the app:

    rails server
    
  7. Enjoy your software.opensuse.org clone at http://127.0.0.1:3000/

If you exit the shell inside the vagrant box your development environment is stopped. Want to continue? Run vagrant up and docker attach software_web again. Happy hacking!

Configuring openSUSE releases

The file config/releases.yml is used by the /distributions end-point to render the right template (leap-$version). Please make sure that (leap-$version) has a corresponding template in both app/data/ and app/views/distribution/. These need to be created while specifying a new (testing_version).

The variables @testing_version, @stable_version and @legacy_version will be set accordingly. @version will be set to the right version of the page you are displaying.

---
- from: '2018-05-25 10:00:00'
  stable_version: '15'
  legacy_version: '42.3'
- from: '2018-01-31 00:00:00'
  stable_version: '42.3'
  testing_version: '15'
  testing_state: 'Beta'
  legacy_version: '42.2'
- from: '2017-07-26 00:00:00'
  stable_version: '42.3'
  legacy_version: '42.2'
- from: '2017-07-08 00:00:00'
  stable_version: '42.2'
  testing_version: '42.3'
  testing_state: 'RC'
  legacy_version: '42.1'
- from: '2016-11-16 00:00:00'
  stable_version: '42.2'
  legacy_version: '42.1'

software-o-o's People

Contributors

digitaltom avatar coolo avatar agraul avatar dmacvicar avatar depfu[bot] avatar ancorgs avatar lnussel avatar ana06 avatar lkocman avatar hennevogel avatar adrianschroeter avatar prusnak avatar scootergrisen avatar skriesch avatar belphegor-belbel avatar hellcp avatar gianvacca avatar freekdk avatar wantoyek avatar ggardet avatar wsxy162 avatar ajaeger avatar fsundermeyer avatar ikapelyukhin avatar mailaender avatar ramaxlo avatar wantoyo avatar alexminton avatar elchevive avatar embar- avatar

Watchers

James Cloos avatar  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.