-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove Flyway and move migrations to Sequelize (#97)
* Ensure sequalizer cli can create models Without passing in additional configuration options. * Add instructions for connecting to db w/dotenv You can use dotenv to load the enviornment variable and it is much cleaner than exporting than manually. * Write migration in Sequelize I looked into a bunch of ways of doing this automatically but none of them worked with the current version of sequelize but it is the most asked for plus-oned feature there is. I just ended up writting it up manually. * Switch JSON to JSONB https://www.depesz.com/2014/03/25/waiting-for-9-4-introduce-jsonb-a-structured-format-for-storing-json/ * Use database dump to create migration file * Add initial data with seeds * Deploy without flyway * Fix deploy to work without flyway Additionally remove flyway migraions and add deploy documentation. * Add a Vagrant up message to help users find app * Remove long hardcoded paths in ansible command * Add a new github oauth app just for Vagrant This has the correct redirects. * Change datatype in initalial migration to jsonb * Use the dotenv-cli to load enviornment vars https://www.npmjs.com/package/dotenv-cli * Fix Addd typo * Fix the undoing the original migration Now `yarn run sequelize -- db:migrate:undo` works. * Rename Database.md to database.md resolving merge conflict due to capitalization file name change (Database.md -> database.md) * update documentation for users who will migrate from flyway to sequelize migration system * Delete .gitignore Co-authored-by: Erika Miguel <[email protected]>
- Loading branch information
Showing
29 changed files
with
1,476 additions
and
315 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -117,3 +117,4 @@ deploy/ansible-vault-password.txt | |
|
||
# Vagrant | ||
/.vagrant/ | ||
deploy/provision.retry |
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,7 @@ | ||
var path = require('path') | ||
|
||
module.exports = { | ||
'models-path': path.resolve('server', 'models'), | ||
'migrations-path': path.resolve('server', 'migrations'), | ||
'seeders-path': path.resolve('server', 'seeders') | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
module.exports = { | ||
development: { | ||
database: process.env.PGDATABASE, | ||
username: process.env.PGUSER, | ||
password: process.env.PGPASSWORD, | ||
host: process.env.PGHOST, | ||
port: process.env.PGPORT, | ||
dialect: 'postgres', | ||
dialectOption: { | ||
ssl: true, | ||
native: true, | ||
multipleStatements: true | ||
}, | ||
seederStorage: 'sequelize', | ||
logging: console.log // eslint-disable-line no-console | ||
} | ||
}; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# Deploying | ||
|
||
## Prerequisite | ||
|
||
- Install [ansible](https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html#installing-ansible) which is used to deploy the application. | ||
- Get a copy of `ansible-vault-password.txt` | ||
- Get a copy of the private key used to access the server get your own public | ||
key placed on the server | ||
|
||
## Testing the deploy with Vagrant | ||
|
||
You can test that a deploy will function by running the deploy in a vagrant that | ||
closely matches that of staging and production. | ||
|
||
First install [vagrant](https://www.vagrantup.com/docs/installation/). | ||
|
||
Copy your `ansible-vault-password.txt` to `deploy/ansible-vault-password.txt`. | ||
|
||
Start the vagrant by running `vagrant up`. | ||
|
||
If you make any changes locally and want to run them again `vagrant rsync && | ||
vagrant up --provision`. | ||
|
||
If you want to debug you can run `vagrant ssh` to ssh into the vagrant box. You | ||
can view logging from ansible with `sudo -i cat /var/log/messages`. | ||
|
||
Once the vagrant box is up you can test by running by going to the ip configured | ||
in the `Vagrantfile` [192.168.10.40](192.168.10.40). | ||
|
||
## Updating passwords | ||
|
||
If you need to update a password to the staging server use ansible vault like: | ||
`ansible-vault decrypt deploy/files/config-staging.env`. | ||
|
||
## How to deploy | ||
|
||
0. Get the prerequisites. | ||
|
||
1. Get a copy of the ansible vault password and place it at `deploy/ansible-vault-password.txt`. | ||
|
||
2. `cd deploy` | ||
|
||
3. `ansible-playbook provision.yml --inventory inventory/staging.yml` | ||
|
||
4. Check if this has been working `http://aria-at-staging.w3.org/` |
Oops, something went wrong.