-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mailer Settings and Documentation Updates #27
Open
zysim
wants to merge
2
commits into
WRSC:master
Choose a base branch
from
zysim:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,65 @@ | ||
# 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 the 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) to install Ruby and rbenv, a Ruby version manager, into your machine. | ||
|
||
|
||
Install ruby packages | ||
|
||
gem install bundle | ||
cd MYR_rails | ||
bundle install | ||
|
||
|
||
## Initialise the database and serve the website in development mode | ||
|
||
export RAILS_ENV=development | ||
bundle exec rake db:migrate | ||
bundle exec rails s | ||
|
||
|
||
## Update the database for competition | ||
|
||
To update the website for a new competition, both the visual front-end and database back-end need to be changed. | ||
|
||
- Most front-end related files are under `MYR_rails/app/views`. | ||
- Database file is under `MYR_rails/db`: | ||
|
||
- Depending on the mode (development, test, production), you'll see a corresponding SQLite file. You will need to configure it manually. | ||
- Edit the seed file under `seeds/` (e.g. `seeds/seeds2018.rb`) and run `bundle exec rake db:seed:seeds2018` to add your own admin users and missions to the competition. | ||
|
||
|
||
## Run the server in production | ||
|
||
### Reinitialise the database for production | ||
|
||
cd tracking/MYR_rails | ||
export RAILS_ENV=production | ||
bundle exec rake db:migrate | ||
bundle exec rake db:seed:seeds2018 # Replace where necessary | ||
|
||
### Run the server in CLI or via Bash script | ||
|
||
#!/bin/bash | ||
cd tracking/MYR_rails | ||
|
||
export RAILS_ENV=production | ||
# Generate a SECRET_TOKEN; `rake secret` can generate one | ||
export SECRET_TOKEN=<SECRET_TOKEN> | ||
# If you haven't already, make sure to generate a SECRET_KEY_BASE too | ||
export SECRET_KEY_BASE=<SECRET_KEY_BASE> | ||
|
||
bundle exec rails s -e production -b 0.0.0.0 -p 80 # Options are, well, optional | ||
|
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 |
---|---|---|
|
@@ -43,4 +43,12 @@ | |
config.action_mailer.default_url_options = { :host => "localhost:3000" } | ||
config.action_mailer.delivery_method = :letter_opener | ||
config.action_mailer.perform_deliveries = true | ||
config.action_mailer.smtp_settings = { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think we need this. As in @kirs 's idea, the email will be previewed in a html page. |
||
:address => "smtp.gmail.com", | ||
:port => 587, | ||
:authentication=> "plain", | ||
:enable_starttls_auto=> true, | ||
:user_name => ENV["GMAIL_USERNAME_DEV"], | ||
:password => ENV["GMAIL_PASSWORD_DEV"], | ||
} | ||
end |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where
SECRET_TOEKN
is used?