diff --git a/CHANGELOG.md b/CHANGELOG.md index 482f306..b67ab08 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Added ### Changed - default to exposing only necessary ports [PR26](https://github.com/hintmedia/railsdock/pull/26) +- move most config to compose file [PR28](https://github.com/hintmedia/railsdock/pull/28) ### Deprecated ### Removed ### Fixed diff --git a/lib/railsdock/commands/install.rb b/lib/railsdock/commands/install.rb index 0b02e7f..8829400 100644 --- a/lib/railsdock/commands/install.rb +++ b/lib/railsdock/commands/install.rb @@ -54,7 +54,6 @@ def execute(input: $stdin, output: $stdout) inject_driver_config(service) append_erb_to_compose_file(service) file.inject_into_file('./docker-compose.yml', "\n #{service}:", after: "\nvolumes:") - append_service_config_to_env(service) if type == :database copy_db_yml("#{BASE_TEMPLATE_DIR}/#{service}/database.yml.erb") inject_db_script_into_entrypoint(service) @@ -129,12 +128,6 @@ def append_erb_to_compose_file(service) file.inject_into_file('./docker-compose.yml', " - #{service}\n", after: "depends_on:\n") end - def append_service_config_to_env(service) - file.safe_append_to_file('./.env') do - ::File.binread("#{BASE_TEMPLATE_DIR}/#{service}/#{service}.env") - end - end - def prompt_for_dockerfile_directory prompt.ask('Where would you like your docker container configuration files to live?') do |q| q.default './docker/' diff --git a/lib/railsdock/templates/install/default/default.env.erb b/lib/railsdock/templates/install/default/default.env.erb index 4e11da9..151b9d9 100644 --- a/lib/railsdock/templates/install/default/default.env.erb +++ b/lib/railsdock/templates/install/default/default.env.erb @@ -13,19 +13,7 @@ COMPOSE_PATH_SEPARATOR=<%= is_windows? ? ';' : ':' %> # Define the prefix of container names. This is useful when there are multiple projects using railsdock COMPOSE_PROJECT_NAME=<%= app_name %> -############################################################################### -######################### Containers Customization ############################ -############################################################################### - - -### RUBY ###################################################################### -# Select a Ruby Version of the Ruby container. Accepted values: 2.2.x-2.7.x +### User Configuration ###################################################### -RAILSDOCK_RUBY_VERSION=<%= ruby_version %> -BUNDLE_JOBS=10 -BUNDLE_RETRY=3 -RAILS_SERVER_HOST_PORT=3000 RUBY_UID=<%= uid %> RUBY_GID=<%= uid %> -# Select a Node Version for the Ruby container. Accepted values: 8-13 -RAILSDOCK_NODE_VERSION=12 diff --git a/lib/railsdock/templates/install/default/docker-compose.yml.erb b/lib/railsdock/templates/install/default/docker-compose.yml.erb index 26f0b4c..65f0587 100644 --- a/lib/railsdock/templates/install/default/docker-compose.yml.erb +++ b/lib/railsdock/templates/install/default/docker-compose.yml.erb @@ -4,10 +4,10 @@ x-ruby: &ruby-base build: context: <%= dockerfile_dir %>ruby args: - - RAILSDOCK_RUBY_VERSION=${RAILSDOCK_RUBY_VERSION} - - RAILSDOCK_NODE_VERSION=${RAILSDOCK_NODE_VERSION} - - RAILSDOCK_BUNDLE_JOBS=${BUNDLE_JOBS} - - RAILSDOCK_BUNDLE_RETRY=${BUNDLE_RETRY} + - RAILSDOCK_RUBY_VERSION=<%= ruby_version %> + - RAILSDOCK_NODE_VERSION=12 + - RAILSDOCK_BUNDLE_JOBS=10 + - RAILSDOCK_BUNDLE_RETRY=3 - RUBY_UID=${RUBY_UID} - RUBY_GID=${RUBY_GID} volumes: @@ -36,4 +36,4 @@ services: command: bundle exec rails server -p 3000 -b '0.0.0.0' entrypoint: ./docker/ruby/entrypoint.sh ports: - - "${RAILS_SERVER_HOST_PORT}:3000" + - "3000:3000" \ No newline at end of file diff --git a/lib/railsdock/templates/install/memcached/docker-compose.yml.erb b/lib/railsdock/templates/install/memcached/docker-compose.yml.erb index aa49729..a922b82 100644 --- a/lib/railsdock/templates/install/memcached/docker-compose.yml.erb +++ b/lib/railsdock/templates/install/memcached/docker-compose.yml.erb @@ -4,6 +4,6 @@ build: context: <%= dockerfile_dir %>memcached args: - - MEMCACHED_VERSION=${MEMCACHED_VERSION} + - MEMCACHED_VERSION=1.5 volumes: - memcached:/var/lib/memcached \ No newline at end of file diff --git a/lib/railsdock/templates/install/memcached/memcached.env b/lib/railsdock/templates/install/memcached/memcached.env deleted file mode 100644 index 5360558..0000000 --- a/lib/railsdock/templates/install/memcached/memcached.env +++ /dev/null @@ -1,5 +0,0 @@ - - -### MEMCACHED ################################################################# - -MEMCACHED_VERSION=1.5 \ No newline at end of file diff --git a/lib/railsdock/templates/install/mysql/docker-compose.yml.erb b/lib/railsdock/templates/install/mysql/docker-compose.yml.erb index b8e9c7b..a07d116 100644 --- a/lib/railsdock/templates/install/mysql/docker-compose.yml.erb +++ b/lib/railsdock/templates/install/mysql/docker-compose.yml.erb @@ -4,8 +4,8 @@ build: context: <%= dockerfile_dir %>mysql args: - - MYSQL_VERSION=${MYSQL_VERSION} + - MYSQL_VERSION=5.7 environment: - - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD} + - MYSQL_ROOT_PASSWORD=Password1 volumes: - mysql:/var/lib/mysql \ No newline at end of file diff --git a/lib/railsdock/templates/install/mysql/mysql.env b/lib/railsdock/templates/install/mysql/mysql.env deleted file mode 100644 index 7dba90b..0000000 --- a/lib/railsdock/templates/install/mysql/mysql.env +++ /dev/null @@ -1,6 +0,0 @@ - - -### MYSQL ##################################################################### - -MYSQL_VERSION=5.7 -MYSQL_ROOT_PASSWORD=Password1 \ No newline at end of file diff --git a/lib/railsdock/templates/install/postgres/docker-compose.yml.erb b/lib/railsdock/templates/install/postgres/docker-compose.yml.erb index d30d92a..b6c846b 100644 --- a/lib/railsdock/templates/install/postgres/docker-compose.yml.erb +++ b/lib/railsdock/templates/install/postgres/docker-compose.yml.erb @@ -4,7 +4,7 @@ build: context: <%= dockerfile_dir %>postgres args: - - POSTGRES_VERSION=${POSTGRES_VERSION} + - POSTGRES_VERSION=12 environment: - POSTGRES_HOST_AUTH_METHOD=trust volumes: diff --git a/lib/railsdock/templates/install/postgres/postgres.env b/lib/railsdock/templates/install/postgres/postgres.env deleted file mode 100644 index 3aa6a3d..0000000 --- a/lib/railsdock/templates/install/postgres/postgres.env +++ /dev/null @@ -1,5 +0,0 @@ - - -### POSTGRES ################################################################## - -POSTGRES_VERSION=11 \ No newline at end of file diff --git a/lib/railsdock/templates/install/redis/docker-compose.yml.erb b/lib/railsdock/templates/install/redis/docker-compose.yml.erb index 8b1b341..7890dfc 100644 --- a/lib/railsdock/templates/install/redis/docker-compose.yml.erb +++ b/lib/railsdock/templates/install/redis/docker-compose.yml.erb @@ -4,6 +4,6 @@ build: context: <%= dockerfile_dir %>redis args: - - REDIS_VERSION=${REDIS_VERSION} + - REDIS_VERSION=5 volumes: - redis:/data \ No newline at end of file diff --git a/lib/railsdock/templates/install/redis/redis.env b/lib/railsdock/templates/install/redis/redis.env deleted file mode 100644 index a4db4b6..0000000 --- a/lib/railsdock/templates/install/redis/redis.env +++ /dev/null @@ -1,5 +0,0 @@ - - -### REDIS ##################################################################### - -REDIS_VERSION=4 \ No newline at end of file