Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/WRSC/tracking
Browse files Browse the repository at this point in the history
  • Loading branch information
Nanoseb committed Aug 25, 2018
2 parents 3d2804e + 5daf44f commit 2458d2a
Show file tree
Hide file tree
Showing 10 changed files with 355 additions and 29 deletions.
64 changes: 64 additions & 0 deletions Doc/server_deploy,md
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

2 changes: 1 addition & 1 deletion MYR_rails/app/assets/javascripts/Real_time/rtmap.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ function FullScreenControl(controlDiv, map) {
var mapOptions = {
mapTypeId: google.maps.MapTypeId.HYBRID,
// center: new google.maps.LatLng(41.691806, -8.821782),
center: new google.maps.LatLng(59.425896, 10.471915),
center: new google.maps.LatLng(50.816272 -1.306495),
zoom: 18,
tilt: 0,
zoomControl: true,
Expand Down
2 changes: 1 addition & 1 deletion MYR_rails/app/views/layouts/_header.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<header id="header" class="clear">
<!-- ################################################################################################ -->
<div id="logo" class="fl_left">
<h1><img class="imgTitleLogo" src= /stylesheets/images/default/logo.PNG > <a href="<%= home_path %>" style="font-size:14px"> WRSC 2017 Tracking </a></h1>
<h1><img class="imgTitleLogo" src= /stylesheets/images/default/logo2018.svg > <a href="<%= home_path %>" style="font-size:14px"> WRSC 2018 Tracking </a></h1>
</div>
<!-- ################################################################################################ -->
<nav id="mainav" class="fl_right">
Expand Down
51 changes: 27 additions & 24 deletions MYR_rails/app/views/static_pages/home.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Licence URI: http://www.os-templates.com/template-terms
<!-- ################################################################################################ -->
<!-- ################################################################################################ -->
<!-- ################################################################################################ -->
<div class="wrapper bgded" style="background-image:url(/stylesheets/images/demo/backgrounds/Web_Autonomus.png);background-size: 100% 100%;">
<div class="wrapper bgded" style="background-image:url(/stylesheets/images/demo/backgrounds/logo2018.svg);background-size: 100% 100%;">
<!--div class="wrapper bgded" style="background-image:url(/stylesheets/images/demo/backgrounds/WRSCIRSC2017.png);"-->

<div id="announce" class="clear">
Expand All @@ -28,12 +28,12 @@ Licence URI: http://www.os-templates.com/template-terms
</a></div>
<div class="one_quarter"><a href="<%= replay_path%>"> <!--replay-->
<div class="hexagon"><i class="icon-calendar"></i>
<p class="nospace"><strong>Replay</strong><br>Click here to replay an event of the WRSC 2017</p>
<p class="nospace"><strong>Replay</strong><br>Click here to replay an event of the WRSC 2018</p>
</div>
</a></div>
<div class="one_quarter"><a href="/map"> <!--replay-->
<div class="hexagon"><i class="icon-map-marker"></i>
<p class="nospace"><strong>Markers</strong><br>Click here to see the next WRSC contests' markers</p>
<p class="nospace"><strong>Markers</strong><br>Click here to see the next WRSC contests markers</p>
</div>
</a></div>
<div class="one_quarter"><a href="<%=signin_path%>"> <!--sign in up-->
Expand All @@ -54,24 +54,28 @@ Licence URI: http://www.os-templates.com/template-terms
<!-- ########################################################################################## -->
<div class="clear center">
<div class="one_quarter first">
<div class="boxedicon"><a href="http://www.ensta-bretagne.eu/"><img class="imgSponsorLogo" src= /stylesheets/images/default/Logo_ENSTA_Bretagne.jpg ></div>
<h2 class="nospace push15 uppercase"><strong>ENSTA Bretagne</strong></h2></a>
<p>French Graduate and Post-graduate Engineering School and Research Institute based in Brest</p>
<div><a href="http://www.southampton.ac.uk"><img class="imgSponsorLogo" src= /stylesheets/images/default/University_of_Southampton_Logo.svg ></div>
<p> </p>
<p> </p>
<h2 class="nospace push15 uppercase"><strong>Host Orgnisation</strong></h2></a>
<p>A world leading research university.</p>
</div>
<div class="one_quarter">
<div class="boxedicon"><a href="http://wrsc2015.com/"><img class="imgSponsorLogo" src= /stylesheets/images/default/Logo_WRSC.jpg ></div>
<h2 class="nospace push15 uppercase"><strong>WRSC</strong></h2></a>
<p>World Robotic Sailing Championship</p>
<div><a href="https://www.noc.ac.uk/"><img class="imgSponsorLogo" src= /stylesheets/images/default/NOC_large.jpg ></div>
<h2 class="nospace push15 uppercase"><strong>Co-Host Orgnisation</strong></h2></a>
<p>The centre of excellence for oceanographic sciences.</p>
</div>
<div class="one_quarter">
<div class="boxedicon"><a href="http://www.ha.ax/text.con?iPage=28&iLan=1"><img class="imgSponsorLogo" src= /stylesheets/images/default/Logo_Aland2.png ></div>
<h2 class="nospace push15 uppercase"><strong>Åland University</strong></h2></a>
<p>University of Applied Sciences based in Åland</p>
<div><a href="https://www.asvglobal.com/"><img class="imgSponsorLogo" src= /stylesheets/images/default/asv_logo.png ></div>
<p> </p>
<br />
<h2 class="nospace push15 uppercase"><strong>Sponsor</strong></h2></a>
<p>Leading supplier of unmanned and autonomous marine systems</p>
</div>
<div class="one_quarter">
<div class="boxedicon"><a href="http://www.alcom.ax/"><img class="imgSponsorLogo" src= /stylesheets/images/default/ALCOM_LOGO.png ></div>
<h2 class="nospace push15 uppercase"><strong>Ålcom Mariehamn</strong></h2></a>
<p>Sponsor of the project</p>
<div class="boxedicon"><a href="https://www.roboticsailing.org/"><img class="imgSponsorLogo" src= /stylesheets/images/default/Logo_WRSC.jpg ></div>
<h2 class="nospace push15 uppercase"><strong>WRSC</strong></h2></a>
<p>All editions of the World Robotic Sailing Championship</p>
</div>
</div>

Expand All @@ -87,16 +91,15 @@ Licence URI: http://www.os-templates.com/template-terms
<footer id="footer" class="clear">
<!-- ################################################################################################ -->
<div>
<h6 class="title">Monitor Your Robot is back for WRSC 2017 !</h6>
<p>After the success of the WRSC 2016, the website and tracking devices will be reused for the 2017 edition. The previous attempts from 2017 are still accessible in the <a href="<%= replay_path%>"> Replay </a> tab.</p><br>
<h6 class="title">What is Monitor Your Robot ?</h6>
<p>This site has been created by students of ENSTA Bretagne for the WRSC 2015 in Mariehamn and allows anyboby to track the robots during the competition.</p><br>
<h6 class="title">Monitor Your Boat</h6>
<p>This page provides real-time tracking, historical race replaying, and marker position displaying for the competition.
To monitor your robot on this page, please register your team and collect a GPS tracker before each challenge. If you need any help please check
the <a href="<%= instructions_path %>" style="text-decoration:underline;"</p>
instructions</a> page or speak to someone in the race committee. </p><br>
<h6 class="title">What is the WRSC ?</h6>
<p>The WRSC is the World Robotic Sailing Championship. The 2015 edition took place in Mariehamn, Åland, between the 1st and the 4th September. The 2016 edition will take place in Viana do Castelo, Portugal, from the 5th to the 10th of September. The 2017 edition of WRSC will be held in Horten, Norway, from 4th to the 8th of September.</p><br>
<h6 class="title">How can I follow the competition ?</h6>
<p>To follow the WRSC 2017 in real time just click on the tab <a href="<%= real_time_path %>"> Real Time </a> !</p>
<h6 class="title">How do I use the site ?</h6>
<p>If you need help for using the website, consult the <a href="<%= instructions_path %>"> instructions </a> page. Or if you did not find your answer, <a href=<%= contact_path %> title="Contact us">contact an administrator</a>.</p>
<p>WRSC stands for the World Robotic Sailing Championship, an international competition aimed to facilitate the research and development of sailing robots. To know more about the competition, please check the <a href="https://www.roboticsailing.org/2018/" style="text-decoration:underline;"</p>
event website</a> and the <a href="https://www.roboticsailing.org/" style="text-decoration:underline;"</p>
competition website</a>. </p><br>
</div>
<div>

Expand Down
6 changes: 3 additions & 3 deletions MYR_rails/config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,13 @@
config.active_record.dump_schema_after_migration = false

# SMTP settings for gmail
config.action_mailer.default_url_options = { :host => "tracking.wrsc2017.com" }
config.action_mailer.default_url_options = { :host => "www.roboticsailing.org/2018/tracking" }
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
address: "smtp.gmail.com",
port: 587,
user_name: "wrscroot@gmail.com",
password: "wrscAdmin2015",
user_name: "wrsc.noreply@gmail.com",
password: "sailrobot",
authentication: "plain",
enable_starttls_auto: true
}
Expand Down
127 changes: 127 additions & 0 deletions MYR_rails/db/seeds/seeds2018.rb
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.
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.
Loading

0 comments on commit 2458d2a

Please sign in to comment.