Open kochalex opened 2 years ago
As you propose your sample as a Dev Environment, you need to convert your Dockerfile to use multistage and add Docker tooling during a dedicated target that will be used in your
.docker/docker-compose.yaml
Thank you, I didn't understand that and will update.
It should be interesting to use the
seeds.rb
file to populate the database and display them in the main page to demonstrate that the ruby application is linked to the database.
I can do that if you'd like - but I was going for something as simple and as close to rails new
as possible with this. There are no database models in the default generated app. As this PR is currently, the Rails application within does need the postgres database to boot and store some basic metadata. The only changes I made to the ./app
directory after running rails new
were adding a Dockerfile
and making Gemfile.lock
track the "aarch64-linux" and "x86_64-linux" platforms for binary ruby gems.
Also do we need the
log
andtmp
directories? Same question for all the directories with only a.keep
file inside?
Rails writes to log
and tmp
by default - it will exit if those do not exist, however they could be added via the Dockerfile
instead if that would be cleaner. The other .keep
files are default locations to put certain types of code, I'm not sure offhand if they are all required. This was all boilerplate from rails new
- if you'd like to see them deleted, I can look into and do that.
I'd say it's fine to keep the log/tmp artifacts of Rails generation. Those directories still get used during development.
Ok for the log/tmp and all the directories created by default by Rails initialiser 👍 @kochalex The purpose of the samples in this repository is it help people to bootstrap/see how they can use Compose to configure multi services applications. So having 2 services running side by side without any interactions together doesn't provide the value we expect for the community, most of the users will expected to learn how they can connect their Rails application to a database running inside an another container.
Another note: Redis is configured in the Rails app, but not in the docker-compose file. This should probably be Rails+Postgres+Redis since I think it's the most common stack.
Signed-off-by: Alex Koch alex@esparklearning.com