1701-jan09-java / interview-evaluations

Interview Evaluations Microservice
MIT License
1 stars 9 forks source link

Simplify development environment set up #54

Closed tjkemper closed 7 years ago

tjkemper commented 7 years ago

Make it easy for contributors to set up their development environment.

tjkemper commented 7 years ago

@cmatheny

Which one? src/main/resources/SQL/development/bash/sql/pg_evaluations_install.sh src/main/resources/SQL/development/bash/pg_evaluations_install.sh

cmatheny commented 7 years ago

src/main/resources/SQL/development/bash/pg_evaluations_install.sh

I removed the other one, it wasn't supposed to be there. Also, src/main/resources/SQL/development/zipped/evaluationsdb-lin.tar.gz is the full package that would be distributed for bash installation. It has all the files from the bash folder archived together.

tjkemper commented 7 years ago

@cmatheny Small changes to bash script:

tjkemper commented 7 years ago

Also created Makefile. Can you test on Windows?

Runs your database script (should detect your operating system)

make init

Builds and runs application using Docker

make
cmatheny commented 7 years ago

A few issues:

This leaves us a few options:

I'm leaning towards the first option since bash is probably expected for other parts of development anyways, and make is a simple single file to add to the path. What are your thoughts?

tjkemper commented 7 years ago

I agree with the first option. For a consistent contributor, having the Makefile is pretty useful. Not sure of all the complications with bash on windows, but it's important we work out the kinks.

Having the same set of commands work in both environments also simplifies our documentation.

DRY

cmatheny commented 7 years ago

I had to change sed again to work on linux and bfw. It has an extension now and should hopefully work for mac as well

sed -i'.bak' '/INTEVAL/d' ~/.bash_profile

the space between -i and the quotes was the problem for me. Also, the new version backs up the profile to .bash_profile.bak which is good practice. Can you make sure it works on mac?

tjkemper commented 7 years ago

Makefile on Mac 👍

tjkemper commented 7 years ago

Working on connecting to database from container.

May run postgres in a container as well.

cmatheny commented 7 years ago

Working on windows and linux. Environment variables are only set inside the bash shell (not windows environment) but this is fine for the docker architecture and IDE will still have access if launched from the bash shell.

Do we want to include the make command for windows in the repo, or link to a download site in the wiki?

tjkemper commented 7 years ago

@cmatheny check out cmatheny/interview-evaluations#1

tjkemper commented 7 years ago

@cmatheny the development environment looks good. Any clean up needed before we merge?

cmatheny commented 7 years ago

I fixed some bugs in the database, filled in some missing dummy data, and added a few QoL improvements to the Makefile:

Everything looks good to me now, if you agree we can go ahead and update the wiki and merge this.

tjkemper commented 7 years ago

@cmatheny I'd rather not have the -i options.

We already provide commands to get logs, so maybe provide the following commands?

All logs: make logs API logs: make logs-api DB logs: make logs-db

tjkemper commented 7 years ago

@cmatheny So we only need the delay on the first ever make up.

I don't think it makes sense to delay every time.

cmatheny commented 7 years ago

@tjkemper I like the -i to save having to run make && make logs every time I rebuild, but we can take it out if you disagree. I could make a bash function locally to do the same thing.

I just added the delay because you said it was sometimes an issue. Is the db connection problem only when it has to download the image? I've never had the timeout problem even after a make clean, so I wasn't sure if it's an issue with then the database is being built or the image being download.

tjkemper commented 7 years ago

Problem: When the database is initially created it needs some time to set up. So the API cannot connect and fails to deploy. This only happens the first time you run make up or after you run make clean. However, I didn't get the problem today 😉

This is foreseeable, but not worth a fix. And we shouldn't sleep every time we run make up.

Did some clean up. The -i commands are ok with me. Ready to merge when you are 👍

tjkemper commented 7 years ago

@cmatheny Do we need src/main/resources/SQL/?

If it's for documentation purposes, we should consider putting those scripts in a docs/ directory.

cmatheny commented 7 years ago

@tjkemper Everything in src/main/resources/SQL/development is obsolete with the docker/makefile setup - the scripts that we're still using are in sql/. The database_tables.sql is outdated and a less accurate representation of the production database than the new create_tables sql file. I think the only relevant thing in there is the layout image, which we should keep and move to docs/.

tjkemper commented 7 years ago

lgtm