Get rid of vagrant

We are using Docker now instead.

Closes https://github.com/openSUSE/osem/issues/1213
This commit is contained in:
Ana María Martínez Gómez 2019-02-21 13:42:21 +01:00 committed by Ana María Martínez Gómez
parent 51f6ad6d14
commit 0aa49e9c64
6 changed files with 1 additions and 171 deletions

View file

@ -34,14 +34,6 @@ Capybara/FeatureMethods:
FactoryBot/AttributeDefinedStatically:
Enabled: false
# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, IndentationWidth.
# SupportedStyles: with_first_parameter, with_fixed_indentation
Layout/AlignParameters:
Exclude:
- 'Vagrantfile'
# Offense count: 4
# Cop supports --auto-correct.
Layout/ClosingParenthesisIndentation:
@ -1347,7 +1339,6 @@ Style/SingleLineMethods:
Style/StringLiterals:
Exclude:
- 'Gemfile'
- 'Vagrantfile'
- 'bin/rspec'
- 'bin/spring'
- 'config/deploy.rb'

View file

@ -66,48 +66,6 @@ sed "s/13042/`id -u`/" docker-compose.override.yml.example > docker-compose.over
docker-compose exec osem_1 /bin/bash -l
```
### with Vagrant
Another option is using [Vagrant](https://www.vagrantup.com/) and [VirtualBox 5.0.10](https://www.virtualbox.org/wiki/Download_Old_Builds_5_0) to create your development environment.
1. Install [vagrant-exec](https://github.com/p0deje/vagrant-exec):
```bash
vagrant plugin install vagrant-exec
```
1. Start the development environment
```
vagrant up
```
1. Start OSEM inside the development environment
```
vagrant exec /vagrant/bin/rails server -b 0.0.0.0
```
6. Check out your OSEM rails app:
You can access the app [localhost:3000](http://localhost:3000). Whatever you change in your cloned repository will have effect in the development environment. Sign up, the first user will be automatically assigned the admin role.
7. Changed something? Test your changes!:
```
vagrant exec bundle exec rspec spec
```
9. Issue any standard `rails`/`rake`/`bundler` command
```
vagrant exec bundle exec rake db:migrate
```
8. Or explore the development environment:
```
vagrant ssh
```
## How to contribute translations
Please refer to our [translation guide](https://github.com/openSUSE/osem/wiki/Translation) in the wiki.

85
Vagrantfile vendored
View file

@ -1,85 +0,0 @@
# frozen_string_literal: true
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
# https://docs.vagrantup.com.
# Every Vagrant development environment requires a box. You can search for
# boxes at https://atlas.hashicorp.com/search.
config.vm.box = "opensuse/openSUSE-42.2-x86_64"
# Disable automatic box update checking. If you disable this, then
# boxes will only be checked for updates when the user runs
# `vagrant box outdated`. This is not recommended.
# config.vm.box_check_update = false
# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below,
# accessing "localhost:8080" will access port 80 on the guest machine.
config.vm.network "forwarded_port", guest: 3000, host: 3000
# Create a private network, which allows host-only access to the machine
# using a specific IP.
# config.vm.network "private_network", ip: "192.168.33.10"
# Create a public network, which generally matched to bridged network.
# Bridged networks make the machine appear as another physical device on
# your network.
# config.vm.network "public_network"
# Share an additional folder to the guest VM. The first argument is
# the path on the host to the actual folder. The second argument is
# the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options.
# config.vm.synced_folder "../data", "/vagrant_data"
# When using the default settings, we will attempt to mount this share
# as the vagrant user and the vagrant group. Alas, box opensuse/openSUSE-42.1-x86_64
# does not have the vagrant group created, so this share fails and
# requires manual mounting for the vagrant setup to continue. Setting
# to the hardcoded numbers will allow the mount to successfully
# mount without working about the group mismatch
VAGRANT_UID = 1000 # User vagrant
VAGRANT_GID = 100 # Group users
config.vm.synced_folder ".", "/vagrant",
owner: VAGRANT_UID, group: VAGRANT_GID
# Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options.
# Example for VirtualBox:
#
# config.vm.provider "virtualbox" do |vb|
# # Display the VirtualBox GUI when booting the machine
# vb.gui = true
#
# # Customize the amount of memory on the VM:
# vb.memory = "1024"
# end
#
# View the documentation for the provider you are using for more
# information on available options.
# Define a Vagrant Push strategy for pushing to Atlas. Other push strategies
# such as FTP and Heroku are also available. See the documentation at
# https://docs.vagrantup.com/v2/push/atlas.html for more information.
# config.push.define "atlas" do |push|
# push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME"
# end
# Enable provisioning with a shell script. Additional provisioners such as
# Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
# documentation for more information about their specific syntax and use.
config.vm.provision :shell, path: "bootstrap.sh"
# config.vm.provision "shell", inline: <<-SHELL
# sudo apt-get update
# sudo apt-get install -y apache2
# SHELL
end

View file

@ -1,25 +0,0 @@
#!/bin/bash
pushd /vagrant
echo -e "\ninstalling required software packages...\n"
zypper -q ar -f http://download.opensuse.org/repositories/devel:/languages:/ruby/openSUSE_Leap_42.2/devel:languages:ruby.repo
zypper -q --gpg-auto-import-keys --non-interactive ref
zypper -q -n install update-alternatives ruby2.4-devel make gcc gcc-c++ \
libxml2-devel libxslt-devel nodejs screen mariadb \
libmysqld-devel sqlite3-devel ImageMagick
echo -e "\ndisabling versioned gem binary names...\n"
echo 'install: --no-format-executable' >> /etc/gemrc
echo -e "\ninstalling bundler...\n"
gem.ruby2.4 install bundler
echo -e "\ninstalling your bundle...\n"
su - vagrant -c "cd /vagrant/; bundle install --quiet"
echo -e "\nConfiguring the app...\n"
su - vagrant -c "cd /vagrant/; bundle exec rake db:bootstrap"
echo -e "\nProvisioning of your OSEM rails app done!"
echo -e "To start your development OSEM run: vagrant exec bundle exec rails server -b 0.0.0.0\n"

View file

@ -1,11 +1,7 @@
Osem::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# Allow the web console from the vagrant host ip
config.web_console.whitelisted_ips = '10.0.2.2'
# Use letter_opener_web for Vagrant (launchy won't work)
config.action_mailer.delivery_method = ENV['USER'] == 'vagrant' ? :letter_opener_web : :letter_opener
config.action_mailer.delivery_method = :letter_opener
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development

View file

@ -14,11 +14,6 @@ Osem::Application.routes.draw do
path: 'accounts'
end
# Use letter_opener_web to open mails in browser (e.g. necessary for Vagrant)
if Rails.env.development?
mount LetterOpenerWeb::Engine, at: "/letter_opener"
end
resources :users, except: [:new, :index, :create, :destroy] do
resources :openids, only: :destroy
end