Ruby on Rails application powering https://software.opensuse.org
We hope you'll get involved! Read our Contributors' Guide for details.
We recommend the usage of Ruby 2.4 or higher for the development.
If you are an openSUSE Tumbleweed user, it comes with the latest Ruby releases as default so you can configure your environment doing:
zypper ref
zypper in ruby ruby-devel ruby2.5-rubygem-bundler nodejs gcc make libxml2-devel libxslt-devel
On openSUSE Leap 42.3 you will need to install the Ruby 2.4 environment doing:
zypper ref
zypper in ruby2.4 ruby2.4-devel ruby2.4-rubygem-bundler nodejs6 gcc make libxml2-devel libxslt-devel
You can find more information about Ruby development and packaging on openSUSE distributions here.
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
git submodule init
git submodule update
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.
The application will take the following environment variables:
SECRET_KEY_BASE
: See Encrypted Session Storage in Rails documentation.API_USERNAME
andAPI_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.
- These can be replaced with
RAILS_ENV
Puma will honor other variables too:
WEB_CONCURRENCY
RAILS_MAX_THREADS
PORT
RACK_ENV
SOFTWARE_O_O_RBTRACE
- If
SOFTWARE_O_O_RBTRACE
is set, you can use rbtrace to debug the application.
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.
If you plan to run the application on PaaS, make sure you set all the above variables correctly.
- There is an included
manifest.yml
tested with SUSE Cloud Application Platform, and it should not be hard to get it running on other Cloud Foundry distributions or hosted PaaS like Heroku.
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
...
There is also a Vagrant setup to create our development environment. All the tools needed for this are available for Linux, MacOS and Windows.
-
Install Vagrant and docker. Both tools support Linux, MacOS and Windows.
-
Clone this code repository:
git clone --recurse-submodules [email protected]:openSUSE/software-o-o.git
-
Build your Vagrant box:
vagrant up
-
Attach to your new development box
docker attach software_web
-
Setup the database
rake db:setup db:seed
-
Start the app
rails server
-
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!