All Projects → Samfundet → Samfundet

Samfundet / Samfundet

Licence: MIT License
Studentersamfundets evige tilstedeværelse på den vide verdensvev.

Programming Languages

ruby
36898 projects - #4 most used programming language
Haml
164 projects
HTML
75241 projects
SCSS
7915 projects
javascript
184084 projects - #8 most used programming language
Gherkin
971 projects

Samfundet.no

samfundet-screenshot

Build Status

Installation

Follow the steps below in order to setup our project locally.

For macOS users: You can try running make setup-mac in the root directory. That command will essentially do everything that this README tells you do to, but we can't guarantee that it works.

Clone

Clone our main repository:

git clone https://github.com/Samfundet/Samfundet.git

We also use two other repositories, SamfundetAuth and SamfundetDomain. These can be cloned with the following commands:

# SamfundetAuth
git clone https://github.com/Samfundet/SamfundetAuth.git

# SamfundetDomain
git clone https://github.com/Samfundet/SamfundetDomain.git

Dependencies

There are several dependencies needed to get Samfundet up and running. Note that RVM is a Ruby version manager used for handling different Ruby versions, but you can use others as well (like rbenv).

macOS

  1. Homebrew: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
  2. imagemagick: brew install imagemagick
  3. graphviz: brew install graphviz
  4. RVM

Linux

Option 1 (Automatic)
  1. Go to your terminal preferences, and select your terminal profile. Go to the "Commands" tab and check "Run command as a login shell".

login-shell-1 login-shell-2

  1. Make sure you have navigated to the project directory in the terminal. Then run the following script: (copy and paste into terminal)
./linux-prerequisites.sh

This will make a script run, that will install a few dependencies for you. A restart is however required after running this script, so restart your computer before proceeding to step 3.

  1. Navigate back to the project and run the following script:
./linux-setup-rvm.sh

A restart is also required after running this script. Restart before proceeding to step 4.

  1. Navigate back to the project and run the following script:
./linux-setup-database.sh

After this script has completed, the project should be up and running!

Option 2 (Manual)
  1. graphviz: sudo apt-get install graphviz
  2. imagemagick: sudo apt-get install imagemagick
  3. nodejs: sudo apt-get install nodejs
  4. ubuntu_rvm
  5. Source RVM: source ~/.rvm/scripts/rvm

We now have all dependencies installed, including RVM, so let's install Ruby 2.5.5. Run these two commands in succession:

rvm install 2.5.5 --movable
rvm use 2.5.5 --default

Setup database

We use PostgreSQL as our database. There are several ways it can be installed depending on your operating system.

Linux

Option 1 (manually)
  • Install PostgreSQL: sudo apt-get install postgresql postgresql-contrib libpq-dev
  • Create the PostgreSQL user: echo -e "CREATE USER samfundet WITH PASSWORD 'samfundet';\nALTER USER samfundet CREATEDB;" | sudo -u postgres psql
Option 2 (Docker)
  1. Install Docker Engine and Docker Compose.
  2. Start the database: docker-compose up -d
  3. Install PostgreSQL: sudo apt-get install libpq-dev

macOS

Option 1 (PostgreSQL macOS application)
Option 2 (Docker)
  1. Install Docker: brew cask install docker
  2. Start the database: docker-compose up -d
  3. Install PostgreSQL: brew install postgresql

Ruby dependencies (gems)

Samfundet depends on several Ruby dependencies called gems that are listed in our Gemfile. To install these, run

bundle install # or just 'bundle' or 'bundler'

Configure database

First, there are some configuration files that needs to be copied. Run

make copy-config-files

Then, setup the database with

bundle exec rails db:setup

Start the development server

You are now ready to start the server. Run

make run # which executes 'bundle exec rails server'

Git hooks

You can optionally add checks before commits et cetera through git/hooks. To apply them run

make git-hooks

This will add symbolic links in .git/hooks from the hooks dir.

License

MIT © Samfundet.no project authors

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].