-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/WRSC/tracking
- Loading branch information
Showing
10 changed files
with
355 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# Server development guide | ||
|
||
|
||
## Get a linux server | ||
|
||
You can use your own server or get a cheap VPS started from Digital Ocean started $5 per month. (referral code to be inserted here) | ||
|
||
## Prepare rails app | ||
|
||
Clone the repository | ||
|
||
git clone https://github.com/WRSC/tracking.git | ||
|
||
Install ruby | ||
|
||
Check this [instruction](https://www.digitalocean.com/community/tutorials/how-to-install-ruby-on-rails-with-rbenv-on-ubuntu-16-04) | ||
|
||
|
||
Install ruby packages | ||
|
||
gem install bundle | ||
cd MYR_rails | ||
bundle install | ||
|
||
|
||
## Initialise the database and serve the website in development mode | ||
|
||
export RAIL_ENV=development | ||
bundle exec rake db:migrate | ||
bundle exec rails s | ||
|
||
|
||
## Update the database for a competition | ||
|
||
To update the website for a new competition, both visual front-end and database back-end need to be changed. | ||
|
||
- Most front-end related files are under `/MYR_rails/app/views` folder. | ||
- Database file is under `/MYR_rails/db` folder. | ||
|
||
- Depends on the mode, you'll see one (development, production, test) of SQLite database there. You do need to configure them manually | ||
- Edit the seed file under `seeds` folder, the `seeds2018` is self-explanatory. After that run `bundle exec rake db:seed:seeds2018` to add admin users and missions to the competition. | ||
|
||
|
||
## Run the server in production environment | ||
|
||
### Repeat the initialise the database and update the database step in production mode | ||
|
||
cd MYR_rails # Assume you are under /tracking/MYR_rails folder | ||
export RAIL_ENV=production | ||
bundle exec rake db:migrate | ||
bundle exec rake db:seed:seeds2018 # Replace when necessary | ||
|
||
|
||
|
||
|
||
### Run in CLI or create a bash script | ||
|
||
#!/bin/bash | ||
export RAIL_ENV=production | ||
export SECRET_KEY=... # Fill in a SECRET_KEY key, 'rake secret' can generate one | ||
|
||
cd tracking/MYR_rails | ||
bundle exec s -e production -b 0.0.0.0 -p 80 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
#SEEDS for WRSC2018 | ||
|
||
#SEEDS for production mode | ||
# /!\ BE CAREFUL WHEN CHANGING THIS SEEDS | ||
# This seed help to configure admin account and setup missions in the competition. | ||
# Follow example seed file to configure your own. | ||
# When the seed file is ready run 'RAILS_ENV=production rake db:seed:seeds2018' | ||
# This will add both admin users and missions to the corresponding database. | ||
|
||
|
||
#Admins | ||
|
||
Member.create!(name: "Yu Cao", | ||
email: "[email protected]", | ||
password: "foobar", | ||
password_confirmation: "foobar", | ||
role: 'administrator', | ||
activated: true, | ||
activated_at: Time.zone.now) | ||
|
||
Member.create!(name: "Thomas Kluyver", | ||
email: "[email protected]", | ||
password: "foobar", | ||
password_confirmation: "foobar", | ||
role: 'administrator', | ||
activated: true, | ||
activated_at: Time.zone.now) | ||
|
||
Member.create!(name: "Captain Seb", | ||
email: "[email protected]", | ||
password: "foobar", | ||
password_confirmation: "foobar", | ||
role: 'administrator', | ||
activated: true, | ||
activated_at: Time.zone.now) | ||
|
||
#Edition | ||
|
||
Edition.create!(name: "WRSC 2018", | ||
id: 1) | ||
|
||
#Missions | ||
|
||
#Fleet Race | ||
|
||
Mission.create!(name: "Fleet Race Sailboat", | ||
start: "20180705000000", | ||
end: "20180827230000", | ||
mtype: "Race", | ||
category: "Sailboat", | ||
edition_id: 1, | ||
id: 1) | ||
|
||
Mission.create!(name: "Fleet Race Micro Sailboat", | ||
start: "20180705000000", | ||
end: "20180827230000", | ||
mtype: "Race", | ||
category: "MicroSailboat", | ||
edition_id: 1, | ||
id: 2) | ||
|
||
#Station Keeping | ||
|
||
Mission.create!(name: "Station Keeping Sailboat", | ||
start: "20180828000000", | ||
end: "20180828230000", | ||
mtype: "StationKeeping", | ||
category: "Sailboat", | ||
edition_id: 1, | ||
id: 3) | ||
|
||
Mission.create!(name: "Station Keeping Micro Sailboat", | ||
start: "20180828000000", | ||
end: "20180828230000", | ||
mtype: "StationKeeping", | ||
category: "MicroSailboat", | ||
edition_id: 1, | ||
id: 4) | ||
|
||
#Area Scanning | ||
|
||
Mission.create!(name: "Area Scanning Sailboat", | ||
start: "20180829000000", | ||
end: "20180829230000", | ||
mtype: "AreaScanning", | ||
category: "Sailboat", | ||
edition_id: 1, | ||
id: 5) | ||
|
||
Mission.create!(name: "Area Scanning Micro Sailboat", | ||
start: "20180829000000", | ||
end: "20180829230000", | ||
mtype: "AreaScanning", | ||
category: "MicroSailboat", | ||
edition_id: 1, | ||
id: 6) | ||
|
||
#Collision Avoidance | ||
|
||
Mission.create!(name: "Collision Avoidance Sailboat", | ||
start: "20180830000000", | ||
end: "20180830230000", | ||
mtype: "CollisionAvoidance", | ||
category: "Sailboat", | ||
edition_id: 1, | ||
id: 7) | ||
|
||
Mission.create!(name: "Collision Avoidance Micro Sailboat", | ||
start: "20180830000000", | ||
end: "20180830230000", | ||
mtype: "CollisionAvoidance", | ||
category: "MicroSailboat", | ||
edition_id: 1, | ||
id: 8) | ||
|
||
#Markers | ||
|
||
|
||
|
||
#Trackers | ||
i=1 | ||
13.times do |n| | ||
token=i | ||
Tracker.create!(token: "#{i}", | ||
description: "Tracker #{i}") | ||
i=i+1 | ||
end |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions
24
MYR_rails/public/stylesheets/images/default/University_of_Southampton_Logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.