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

[Feat] Easy setup for Postgre on Linux with Docker #2

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open

[Feat] Easy setup for Postgre on Linux with Docker #2

wants to merge 4 commits into from

Conversation

phoenisx
Copy link
Contributor

@phoenisx phoenisx commented Aug 2, 2019

Context

Have added Docker setup for dev environment, where a user needs to do some pre-setup as mentioned in README.md and just run docker-compose up for the services to start.

Prod Docker setup has been added as well, but as extra files. We can take a reference from them and update USERNAME/DBNAME when deployed to prod.

@SitiSchu
Copy link
Member

SitiSchu commented Aug 2, 2019

Not familiar with docker but wouldn't it make sense to have a Dockerfile instead of a shell script?

@phoenisx
Copy link
Contributor Author

phoenisx commented Aug 2, 2019

Yeah! That's true. But, would work on that later, and remove this file, as for that kind of setup, even the Server should start using Docker.

@SitiSchu
Copy link
Member

SitiSchu commented Aug 2, 2019

Using docker compose would probably make the most sense then

@SitiSchu SitiSchu self-assigned this Aug 2, 2019
@phoenisx phoenisx requested a review from SitiSchu as a code owner August 3, 2019 14:44
@phoenisx
Copy link
Contributor Author

phoenisx commented Aug 3, 2019

Hi @SitiSchu I have tested compose file with only Postgres as container. But, when creating API server image for Cargo project, on my system it fails. If it fails for you as well, we can put this PR on hold for a while. Will work on this later then!

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
docker-compose.yml Outdated Show resolved Hide resolved
@SitiSchu
Copy link
Member

SitiSchu commented Aug 4, 2019

When running docker-compose up I do get a error for the api service so I guess we can hold off on this for now

Dockerfile Show resolved Hide resolved
Dockerfile Show resolved Hide resolved
@phoenisx
Copy link
Contributor Author

phoenisx commented Aug 16, 2019

When running docker-compose up I do get a error for the api service so I guess we can hold off on this for now

Do create a secrets folder before u run docker-compose up
I have updated the README for details on application startup using docker-compose

@SitiSchu This PR is in working state now. 💯

@phoenisx phoenisx changed the title [Feat] Easy setup for Postgre on Linux with Docker WIP: [Feat] Easy setup for Postgre on Linux with Docker Aug 16, 2019
@phoenisx phoenisx changed the title WIP: [Feat] Easy setup for Postgre on Linux with Docker [Feat] Easy setup for Postgre on Linux with Docker Aug 16, 2019
Copy link

@robbyoconnor robbyoconnor left a comment

Choose a reason for hiding this comment

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

Not sure if I like the whole two Dockerfile approach -- there has to be a way to do this with one.

ENV RUST_BACKTRACE 1

CMD ["cargo", "run"]

Choose a reason for hiding this comment

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

Why do you have two Dockerfiles?

Copy link
Contributor Author

@phoenisx phoenisx Oct 28, 2019

Choose a reason for hiding this comment

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

Well, to separate out deployment logics for production and dev builds. Having two separate ways of deployment, helps you manage separate concerns. For eg, in production build, you can remove the source code (atleast for Rust, as you will get a compiled binary, to reduce the docker image size), that got copied earlier.

Also, it helps to keep different rust versions, till the dev is properly tested and can be deployed to Production.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also check this - https://users.rust-lang.org/t/why-does-cargo-build-not-optimise-by-default/4150
where release build can be a lot more slower to compile.

Copy link

@robbyoconnor robbyoconnor Oct 28, 2019

Choose a reason for hiding this comment

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

I'm still not sure I like it... there has to be a cleaner way to do this...make an env var or something and a script?

Copy link
Contributor Author

@phoenisx phoenisx Oct 28, 2019

Choose a reason for hiding this comment

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

I can understand your concern, and keeping things DRY, but if docker commands varies (like for dev and prod), we need separate Dockerfiles, as they are supposed to be pre-built and cached in the hub, with different tags.

Not sure if env vars can be used in images (as in used in Docker Commands), but even if they did, they will make Docker images in-consistent.

What I can think of is, Docker itself acts as an environment specific deployment strategy (just like envs). Each Environment having it's own set of deployment instructions, unless some environments have to be deployed with the exact same build, (like staging/prod can have a single Docker file).

Choose a reason for hiding this comment

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

I suppose. Also Dockerfile, NOT DOCKERFILE

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.

None yet

4 participants