Skip to content
This repository has been archived by the owner on Apr 9, 2020. It is now read-only.

Commit

Permalink
correct robot-environment configs and control scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
dazza-codes committed Jul 7, 2017
1 parent d213725 commit df667d3
Show file tree
Hide file tree
Showing 7 changed files with 74 additions and 68 deletions.
6 changes: 3 additions & 3 deletions README.md
Expand Up @@ -16,7 +16,7 @@ See the [Wiki](https://github.com/sul-dlss/robot-master/wiki) for general docume
- config
- certs : authentication certificates for workflow service
- deploy : host-level Capistrano configuration
- environments : configuration for dev,test,prod environments
- environments : configuration for dev,stage,prod environments
- workflows : workflow specific configuration - steps, dependencies. One directory per workflow.
- lib : ruby classes needed for your local robots
- sdrIngest : all of the robots for a particular workflow. One directory per workflow
Expand Down Expand Up @@ -70,9 +70,9 @@ See `bin/cron_jobs.txt` or `ssh` onto a deploy system and run `crontab -e`.
```
```ruby
# modify the defaults, e.g.
#ENV['SDR_HOST'] ||= 'sdr-staging1'
#ENV['SDR_HOST'] ||= 'sdr-stage1'
#ENV['SDR_USER'] ||= 'sdr_user'
#ENV['ROBOT_ENVIRONMENT'] = 'staging'
#ENV['ROBOT_ENVIRONMENT'] = 'stage'
# Note that the value of ROBOT_ENVIRONMENT entails the existence of two config files:
# config/environments/${ROBOT_ENVIRONMENT}.rb
# config/environments/robots_${ROBOT_ENVIRONMENT}.yml
Expand Down
8 changes: 4 additions & 4 deletions bin/environment.rb
Expand Up @@ -16,11 +16,11 @@
# Make sure a value is set for ROBOT_ENVIRONMENT
ENV['ROBOT_ENVIRONMENT'] = (
case `hostname -s`.chomp
when "sdr-services", "sul-sdr-services"
when 'sul-sdr-services'
'production'
when "sdr-services-test"
'staging'
when "sul-sdr-services-dev"
when 'sdr-services-test', 'sdr-services-test2'
'stage'
when 'sul-sdr-services-dev'
'integration'
else
'development'
Expand Down
66 changes: 66 additions & 0 deletions bin/sdr-preservation-core_ctl.sh
@@ -0,0 +1,66 @@
#!/bin/bash

if [ -d ~/sdr-preservation-core/current ]; then
cd ~/sdr-preservation-core/current
else
echo "ERROR: There is no application installation in ~/sdr-preservation-core/current"
exit 1
fi


# ----
# The ROBOT_ENVIRONMENT values here should match the config/environment/* files in the shared configs at
# https://github.com/sul-dlss/shared_configs/tree/sdr-preservation-core_{stage} where
# {stage} is a capistrano stage, like 'dev|stage|prod'.

HOSTNAME=$(hostname -s)
case "$HOSTNAME" in
'sul-sdr-services')
export ROBOT_ENVIRONMENT='production'
;;

'sdr-services-test' | 'sdr-services-test2')
export ROBOT_ENVIRONMENT='stage'
;;

'sul-sdr-services-dev')
export ROBOT_ENVIRONMENT='integration'
;;

*)
echo "WARNING: defaulting to localhost 'development'"
export ROBOT_ENVIRONMENT='development'
;;
esac

echo "Using ROBOT_ENVIRONMENT=$ROBOT_ENVIRONMENT"


# ----
# Robot control commands:

case "$1" in
start)
bundle exec controller boot
;;

stop)
bundle exec controller stop
bundle exec controller quit
;;

status)
bundle exec controller status
;;

restart)
bundle exec controller stop
bundle exec controller quit
bundle exec controller boot
;;

*)
echo "Usage: $0 {start|stop|restart|status}"
exit 1
esac

21 changes: 0 additions & 21 deletions bin/sdr-preservation-core_restart.sh

This file was deleted.

19 changes: 0 additions & 19 deletions bin/sdr-preservation-core_status.sh

This file was deleted.

20 changes: 0 additions & 20 deletions bin/sdr-preservation-core_stop.sh

This file was deleted.

2 changes: 1 addition & 1 deletion config/deploy/stage.rb
Expand Up @@ -4,7 +4,7 @@
# ROBOT_ENVIRONMENT implies remote :deploy_to contains
# config/environments/#{ROBOT_ENVIRONMENT}.rb
# config/environments/robots_#{ROBOT_ENVIRONMENT}.rb
'ROBOT_ENVIRONMENT' => 'test'
'ROBOT_ENVIRONMENT' => 'stage'
}

server 'sdr-services-test.stanford.edu', user: 'sdr2service', roles: %w{app}
Expand Down

0 comments on commit df667d3

Please sign in to comment.