Skip to content
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

Add production deployment scripts #81

Merged
merged 7 commits into from
Jun 18, 2019
Merged

Add production deployment scripts #81

merged 7 commits into from
Jun 18, 2019

Conversation

gauravchl
Copy link
Member

No description provided.

- cd into `repos/cb-connect/scripts/` and run `./build.sh`
this will create a bundle file inside `/cb-connect/bundles`
- When `./build.sh` script will run successfully, it will output the deploy command like: `./deploy.sh XYZ` where XYZ is the commit hash.
- Copy and run the deploy command, it will deploy the bundle. In case of emergencies or failed deployment you can rollback the last release by running `./deploy.sh` script with previous hash.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure to remove the bundle files inside /cb-connect/bundles after it grows to ~100 or more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: Move mongo creds from ./deploy.sh to settings.json.


export COMMIT_HASH=$1
export ROOT_URL='https://connect.codebuddies.org'
export MONGO_URL='mongodb+srv://rootuser:[email protected]/cb-connect'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of hardcoding it here, can we set it up as an environment variable manually in DO? I don't think this needs to be part of the script.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know @lpatmo mentioned it's no longer valid, but from my understanding, every time we deploy does this script gets ran and updates the variables in the droplet?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right now, deployment is manual -- we have to ssh into the droplet and run ./deploy. Two todos we have are:
1/ Move the mongourl creds into settings.json
2/ Put the deployment script into a webhook so that changes to the master branch trigger an automatic deployment

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, so to my understanding, every time we run ./deploy, then the environment variables get reset, and if the mongo_url is no longer valid, then we're setting the variables with incorrect values. Am I assuming that correctly?

Instead of using settings.json, would now be a good time to bring up #32 again? I think that would make things more straightforward.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#32 is about using .dotenv, not a production settings.json file living in the droplet?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct - we'd drop settings.json all together and use .env files instead. Our local .env files will be in ignored with git (we'll use .env.example as a way for contributors to see what variables they'd need to get) and define process variables manually in DO.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, cool! Sure, that sounds like a good alternative.

@lpatmo lpatmo merged commit 5f5b2bf into staging Jun 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants