Skip to content
This repository was archived by the owner on Jul 24, 2020. It is now read-only.

Finish Capistrano / get Yale ITS deployment set up #1074

Closed
3 tasks done
orenyk opened this issue Dec 29, 2014 · 25 comments · Fixed by #1270
Closed
3 tasks done

Finish Capistrano / get Yale ITS deployment set up #1074

orenyk opened this issue Dec 29, 2014 · 25 comments · Fixed by #1270

Comments

@orenyk
Copy link
Contributor

orenyk commented Dec 29, 2014

I know that this isn't really a general application issue, but we need to get the ITS deployment procedure aligned with the changes implemented in #683. We can use this to finalize the implementation of Capistrano so that we hopefully have a well-documented example of how one might deploy an instance of Reservations.


2015-02-15

Here are some things that need to be done.

@orenyk orenyk added this to the Wish List milestone Dec 29, 2014
@orenyk orenyk mentioned this issue Jan 4, 2015
@orenyk orenyk modified the milestones: Wish List, 5.2.0 Feb 10, 2015
@dgoerger
Copy link
Contributor

@orenyk what's left to get Capistrano working? Does it work on e.g. laptops, if I were to git clone reservations and run a cap production deploy? Is there anything I can help with on the sysadmin side?

@orenyk
Copy link
Contributor Author

orenyk commented Feb 15, 2015

Ummm... good question. It's set up to use localhost as the server but would require a hudson user at the moment. I haven't set up deploy.rb to copy over the secrets.yml file, so that would still be necessary, but other than that you'd have to set some environment variables and it should work. Maybe we should make the user configurable as an environment variable as well so that the whole Capistrano setup is as general as possible.

From ITS' side, we're basically going to need to copy all of the Jenkins parameters into a .env file and pass the deployment path to Capistrano as an environment variable as well. We should set up a meeting over the next month or so to hash this all out, but in the meantime look over #683 and the relevant wiki pages and let me know if anything jumps out at you.

@dgoerger
Copy link
Contributor

I think the localhost/hudson and secrets.yml is something INF can replace with sed for example, much like we do now---and just dump the parameters into a .env perhaps instead of running it all as bash environment variables.

These are all the BMEC vars (available in /ror_dev/ruby_deploy/reservations01/install-PROD-BMEC_properties):

rails_environment=${deployment_env}
app_path=/path/to/install/directory
database=${bmec_db}
database_host=${which_server_hosts_bmec_db}
db_username=${bmec_db_username}
db_password=${bmec_db_password}
uri=/bmec

The Configuration doc looks pretty thorough. Does it work if one submits dummy values (e.g. localhost with Yale CAS and SMTP) for both the staging and production envs? It would be best to make sure that's working before INF gets involved---once it's confirmed working, we should definitely set up a meeting with Michael and get this going. 😀

@orenyk orenyk added diff: 5 and removed diff: 3 labels Mar 26, 2015
@orenyk orenyk modified the milestones: 5.2.0, 5.3.0 Mar 30, 2015
@orenyk orenyk modified the milestones: 5.3.0, 5.4.0 Apr 12, 2015
@orenyk orenyk modified the milestones: 5.4.0, 5.3.0 May 6, 2015
@orenyk
Copy link
Contributor Author

orenyk commented Jun 1, 2015

Ok, things are slowly moving. I've been trying to get this working on a DigitalOcean droplet running CentOS w/ Passenger and Apache (to get close to our setup in ITS) and it's... getting there 😕. Currently, I've got cap production deploy working until it tries to precompile assets when it fails because I haven't yet run the task that copies over database.yml. Hopefully I'll get it working soon and then we can hand it over to ITS to finish up.

One other thing to note: we've got pg in our production group in the Gemfile; this is so that we can deploy to Heroku. However, it also means that when you run bundle install you have to have postgresql and postgresql-devel (I think) installed on your app server so that it can install the pg gem, even if you're not using it. I'm not sure what the best way to handle this is, and whether or not ITS would be willing to just install those dependencies so that I don't need to figure out a workaround. We'll see...

@orenyk
Copy link
Contributor Author

orenyk commented Jun 1, 2015

More to do:

  • don't forget to have it working with localhost (I ran into issues with the ssh shell / rbenv not working, see here, rbenv seems to be problematic)
  • take all the rbenv stuff out of deploy.rb and go back to rvm

@orenyk
Copy link
Contributor Author

orenyk commented Jun 1, 2015

Ok, better but still stuck. I'm having trouble using the test commend from SSHKit, it's returning unknown command '['. Will investigate later.

@orenyk
Copy link
Contributor Author

orenyk commented Jun 2, 2015

Ok, from memory ITS is using Passenger to deal with assets rather than through Rails, so I'm going to look into that now.

@orenyk
Copy link
Contributor Author

orenyk commented Jun 2, 2015

Never mind, I had a relative subdirectory set in the configuration parameters (e.g. example.com/test) so the asset URL's were pointing to non-existent locations. For some reason the restart mechanism isn't working, nor is the whenever crontab generation task. The investigation continues...

@orenyk
Copy link
Contributor Author

orenyk commented Jun 2, 2015

💥

@orenyk
Copy link
Contributor Author

orenyk commented Jun 2, 2015

just testing party foul, but I think this is basically ready 😄

@orenyk
Copy link
Contributor Author

orenyk commented Jun 2, 2015

Got it to work by tweaking the initializer to create errors for ActiveRecord::RecordNotFound exceptions and removing the rescue_from block in ApplicationController --> we have a successful deployment 😄. Now just to clean up and we'll go from there.

@orenyk
Copy link
Contributor Author

orenyk commented Jun 2, 2015

Note that the current syntax would be GIT_TAG=v1.2.3 DEPLOY_DIR=/path/to/dir PARAM_FILE=/path/to/file cap production deploy

@orenyk
Copy link
Contributor Author

orenyk commented Jun 2, 2015

PR opened, I'm just going to run through it's diff later to see if there's anything I'd like to clean up and then it should be ready for review / kicking up the ladder 😄.

orenyk added a commit that referenced this issue Jun 2, 2015
Resolves #1074
- finalize deploy script setup
- finalize custom tasks for deployment
- move custom tasks to lib/capistrano/tasks directory
- other tweaks / fixes
@orenyk
Copy link
Contributor Author

orenyk commented Jun 3, 2015

@dgoerger: any chance you could check this out and let me know if you think we're ready to set up a meeting w/ ITS? Thanks!

@orenyk
Copy link
Contributor Author

orenyk commented Jun 16, 2015

... still waiting on ITS to start testing...

orenyk added a commit that referenced this issue Sep 13, 2015
Resolves #1074
- finalize deploy script setup
- finalize custom tasks for deployment
- move custom tasks to lib/capistrano/tasks directory
- update dotenv to 2.0.2; remove dotenv-deployment (deprecated)
- other tweaks / fixes
orenyk added a commit that referenced this issue Sep 13, 2015
Resolves #1074
- finalize deploy script setup
- finalize custom tasks for deployment
- move custom tasks to lib/capistrano/tasks directory
- update dotenv to 2.0.2; remove dotenv-deployment (deprecated)
- other tweaks / fixes
@orenyk orenyk modified the milestones: 5.4.0, 5.3.0 Sep 16, 2015
orenyk added a commit that referenced this issue Sep 16, 2015
Resolves #1074
- finalize deploy script setup
- finalize custom tasks for deployment
- move custom tasks to lib/capistrano/tasks directory
- update dotenv to 2.0.2; remove dotenv-deployment (deprecated)
- other tweaks / fixes
orenyk added a commit that referenced this issue Sep 17, 2015
Resolves #1074
- finalize deploy script setup
- finalize custom tasks for deployment
- move custom tasks to lib/capistrano/tasks directory
- update dotenv to 2.0.2; remove dotenv-deployment (deprecated)
- fix broken migration by bypassing Reservation validations
- other tweaks / fixes
orenyk added a commit that referenced this issue Sep 17, 2015
Resolves #1074
- finalize deploy script setup
- finalize custom tasks for deployment
- move custom tasks to lib/capistrano/tasks directory
- update dotenv to 2.0.2; remove dotenv-deployment (deprecated)
- fix broken migration by bypassing Reservation validations
- other tweaks / fixes
orenyk added a commit that referenced this issue Sep 20, 2015
Resolves #1074
- finalize deploy script setup
- finalize custom tasks for deployment
- move custom tasks to lib/capistrano/tasks directory
- update dotenv to 2.0.2; remove dotenv-deployment (deprecated)
- fix broken migration by bypassing Reservation validations
- add environment variable to disable all e-mails (DISABLE_EMAILS)
- other tweaks / fixes
@orenyk orenyk modified the milestones: 5.3.0, 5.4.0 Sep 20, 2015
@orenyk
Copy link
Contributor Author

orenyk commented Sep 20, 2015

I will be writing / updating our documentation shortly to include the use of Capistrano for deployment.

orenyk added a commit that referenced this issue Sep 20, 2015
@orenyk
Copy link
Contributor Author

orenyk commented Sep 20, 2015

Just realized that the whenever crontab update might not be running, might need an immediate patch to v5.3.0 😛. Just testing now, DigitalOcean is awesome!

@orenyk
Copy link
Contributor Author

orenyk commented Sep 20, 2015

Whoops, I'm an idiot, I have it set to only call update_cron when it's deploying to production. Unfortunately that won't help ITS, so they might have to manually delete cron jobs on DEV, but I'm glad I set everything up properly 😛.

@orenyk
Copy link
Contributor Author

orenyk commented Sep 20, 2015

On second thought, some of our cron tasks are not e-mail related, so we probably want them running on all environments. I'll open an issue for further investigation.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants