Last active
June 4, 2025 22:19
-
-
Save juanca/b627f87a98229f36b5e456d59299214f to your computer and use it in GitHub Desktop.
Revisions
-
juanca revised this gist
Dec 26, 2024 . 1 changed file with 1 addition and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -3,8 +3,7 @@ 1. Initialize your project folder: `git init` 2. Create your project files with a ruby image: docker run -it -v .:/rails/<app_name> -w /rails/<app_name> ruby:latest /bin/bash gem install rails rails new . exit -
juanca revised this gist
Aug 3, 2024 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -108,4 +108,5 @@ 2. `docker compose run app /bin/bash` 3. `curl -L https://fly.io/install.sh | sh` 4. `/root/.fly/bin/fly auth login` 5. `/root/.fly/bin/fly launch` NOTE: Use Web UI to confirm settings! 6. After which you can just deploy: `docker compose run app /root/.fly/bin/fly deploy` -
juanca revised this gist
Aug 3, 2024 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -108,4 +108,4 @@ 2. `docker compose run app /bin/bash` 3. `curl -L https://fly.io/install.sh | sh` 4. `/root/.fly/bin/fly auth login` 5. `/root/.fly/bin/fly launch` NOTE: Use Web UI to confirm settings! -
juanca revised this gist
Aug 3, 2024 . 1 changed file with 4 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -105,6 +105,7 @@ volumes: fly: 2. `docker compose run app /bin/bash` 3. `curl -L https://fly.io/install.sh | sh` 4. `/root/.fly/bin/fly auth login` 5. `/root/.fly/bin/fly auth launch` NOTE: Use Web UI to confirm settings! -
juanca revised this gist
Aug 3, 2024 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -105,6 +105,6 @@ volumes: fly: 2. Install flyctl: `docker compose run app /bin/bash` then `curl -L https://fly.io/install.sh | sh` 3. `/root/.fly/bin/fly auth login` 4. `/root/.fly/bin/fly auth launch` NOTE: Use Web UI to confirm settings! -
juanca revised this gist
Aug 3, 2024 . 1 changed file with 4 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -45,23 +45,21 @@ 1. Create a `docker-compose.yml`: services: app: build: context: . dockerfile: Dockerfile.dev command: ./bin/rails server -b 0.0.0.0 ports: - "3000:3000" volumes: - .:/rails ## Postgres 1. Setup docker service: services: app: # ... -
juanca revised this gist
Aug 3, 2024 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ ## Bootstrap project 1. Initialize your project folder: `git init` 2. Create your project files with a ruby image: docker run -it -v .:/rails/<app_name> ruby:latest /bin/bash -
juanca revised this gist
Aug 3, 2024 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -33,6 +33,8 @@ 2. Setup the application: `docker compose run app bin/setup` 3. Start the application: `docker compose up` ## Advanced environment 1. Copy the `Dockerfile` into a new `Dockerfile.dev` -
juanca revised this gist
Aug 3, 2024 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -31,6 +31,8 @@ volumes: bundle: 2. Setup the application: `docker compose run app bin/setup` ## Advanced environment 1. Copy the `Dockerfile` into a new `Dockerfile.dev` -
juanca revised this gist
Aug 3, 2024 . 1 changed file with 6 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -22,12 +22,12 @@ app: image: ruby:<version from gemfile> command: ./bin/rails server -b 0.0.0.0 ports: - "3000:3000" volumes: - .:/rails/<app_name> - bundle:/usr/local/bundle working_dir: /rails/<app_name> volumes: bundle: -
juanca revised this gist
Aug 3, 2024 . 1 changed file with 0 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -18,7 +18,6 @@ 1. Create a `docker-compose.yml`: services: app: image: ruby:<version from gemfile> -
juanca revised this gist
Aug 3, 2024 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -3,7 +3,7 @@ 1. Initialize your project folder with git: `git init` and create `.gitignore` 2. Create your project files with a ruby image: docker run -it -v .:/rails/<app_name> ruby:latest /bin/bash cd /rails/<app_name> gem install rails rails new . @@ -21,7 +21,7 @@ version: "3" services: app: image: ruby:<version from gemfile> command: ./bin/rails server -b 0.0.0.0 ports: - "3000:3000" -
juanca renamed this gist
Aug 3, 2024 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
juanca revised this gist
May 20, 2024 . 1 changed file with 20 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -56,7 +56,7 @@ ## Postgres 1. Setup docker service: version: "3" services: @@ -88,4 +88,22 @@ # For details on connection pooling, see Rails configuration guide # https://guides.rubyonrails.org/configuring.html#database-pooling pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> username: postgres ## Fly.io (WIP) 1. Setup docker volume: services: app: # ... volumes: # ... - fly:/root/.fly # ... volumes: fly: 2. Install flyctl: `...` 3. `/root/.fly/bin/fly auth login` 4. `/root/.fly/bin/fly auth launch` NOTE: Use Web UI to confirm settings! -
juanca revised this gist
May 20, 2024 . 1 changed file with 9 additions and 9 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -80,12 +80,12 @@ 5. `docker compose run app bin/setup` 6. Modify `./config/database.yml`: default: &default adapter: postgresql encoding: unicode host: <%= ENV["DATABASE_HOST"] %> password: <%= ENV["DATABASE_PASSWORD"] %> # For details on connection pooling, see Rails configuration guide # https://guides.rubyonrails.org/configuring.html#database-pooling pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> username: postgres -
juanca revised this gist
May 20, 2024 . 1 changed file with 16 additions and 16 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -58,22 +58,22 @@ 1. Setup docker service version: "3" services: app: # ... environment: DATABASE_HOST: db DATABASE_PASSWORD: password # ... db: image: postgres:15 environment: POSTGRES_PASSWORD: password volumes: - db:/var/lib/postgresql/data volumes: db: 3. Run `db` docker service: `docker compose up db` 4. `docker compose run app bin/rails db:system:change --to=postgresql` -
juanca revised this gist
May 20, 2024 . 1 changed file with 3 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -76,8 +76,9 @@ db: 3. Run `db` docker service: `docker compose up db` 4. `docker compose run app bin/rails db:system:change --to=postgresql` 5. `docker compose run app bin/setup` 6. Modify `./config/database.yml`: default: &default adapter: postgresql -
juanca revised this gist
May 20, 2024 . 1 changed file with 5 additions and 7 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -9,6 +9,11 @@ rails new . exit 3. Configure the rails web console to work in docker in `development.rb`: # Allow IRB in browser for a docker environment config.web_console.permissions = '0.0.0.0/0' ## Simple environment 1. Create a `docker-compose.yml`: @@ -49,13 +54,6 @@ volumes: - .:/rails ## Postgres 1. Setup docker service -
juanca revised this gist
May 20, 2024 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ ## Bootstrap project 1. Initialize your project folder with git: `git init` and create `.gitignore` 2. Create your project files with a ruby image: docker run -it -v .:/rails/<app_name> ruby:3.2.2 /bin/bash cd /rails/<app_name> -
juanca revised this gist
May 20, 2024 . 1 changed file with 41 additions and 22 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,19 +1,41 @@ ## Bootstrap project 1. Initialize your project folder with git: `git init` and create `.gitignore` 2. Create your project files with a temporary ruby image: docker run -it -v .:/rails/<app_name> ruby:3.2.2 /bin/bash cd /rails/<app_name> gem install rails rails new . exit ## Simple environment 1. Create a `docker-compose.yml`: version: "3" services: app: image: ruby:3.2.2 command: ./bin/rails server -b 0.0.0.0 ports: - "3000:3000" volumes: - .:/rails/<app_name> - bundle:/usr/local/bundle working_dir: /rails/<app_name> volumes: bundle: ## Advanced environment 1. Copy the `Dockerfile` into a new `Dockerfile.dev` 1. Remove any environment variables 2. Modify `bundle install` step to _only_ bundle install 3. Remove precompilation steps 4. Test it with `docker build Dockerfile.dev .` 1. Create a `docker-compose.yml`: version: "3" services: @@ -27,28 +49,25 @@ volumes: - .:/rails ## Additional docker-specific configuration 1. Configure the rails web console to work in docker in `development.rb`: # Allow IRB in browser for a docker environment config.web_console.permissions = '0.0.0.0/0' ## Postgres 1. Setup docker service version: "3" services: app: # ... environment: DATABASE_HOST: db DATABASE_PASSWORD: password # ... db: image: postgres:15 environment: @@ -58,9 +77,9 @@ volumes: db: 3. Run `db` docker service: `docker compose up db` 4. `bin/rails db:system:change --to=postgresql` 5. Modify `./config/database.yml`: default: &default adapter: postgresql -
juanca revised this gist
Mar 14, 2024 . 1 changed file with 41 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -30,4 +30,44 @@ 5. Configure the rails web console to work in docker in `development.rb`: # Allow IRB in browser for a docker environment config.web_console.permissions = '192.168.0.0/16' 6. Migrating to postgres: 1. Setup docker service version: "3" services: app: build: context: . dockerfile: Dockerfile.dev command: ./bin/rails server -b 0.0.0.0 environment: DATABASE_HOST: db DATABASE_PASSWORD: password ports: - "3000:3000" volumes: - .:/rails db: image: postgres:15 environment: POSTGRES_PASSWORD: password volumes: - db:/var/lib/postgresql/data volumes: db: 3. Run `db` docker service: `docker compose up db` 4. `bin/rails db:system:change --to=postgresql` 5. Modify `./config/database.yml`: default: &default adapter: postgresql encoding: unicode host: <%= ENV["DATABASE_HOST"] %> password: <%= ENV["DATABASE_PASSWORD"] %> # For details on connection pooling, see Rails configuration guide # https://guides.rubyonrails.org/configuring.html#database-pooling pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> username: postgres -
juanca revised this gist
Mar 11, 2024 . 1 changed file with 11 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,19 +1,22 @@ 1. Initialize your project folder with git: `git init` 2. Create (and commit) your project files with a temporary ruby image: docker run -it -v .:/rails ruby:3.2.2 /bin/bash cd /rails gem install rails rails new . exit 3. Copy the `Dockerfile` into a new `Dockerfile.dev` 1. Remove any environment variables 2. Modify `bundle install` step to _only_ bundle install 3. Remove precompilation steps 4. Test it with `docker build Dockerfile.dev .` 4. Create a `docker-compose.yml`: version: "3" services: app: build: context: . @@ -24,7 +27,7 @@ volumes: - .:/rails 5. Configure the rails web console to work in docker in `development.rb`: # Allow IRB in browser for a docker environment config.web_console.permissions = '192.168.0.0/16' -
juanca revised this gist
Mar 11, 2024 . 1 changed file with 21 additions and 16 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,25 +1,30 @@ 1. Initialize your project folder with git: `git init` 1. Create (and commit) your project files with a temporary ruby image: docker run -it -v .:/rails ruby:3.2.2 /bin/bash cd /rails gem install rails rails new . exit 1. Copy the `Dockerfile` into a new `Dockerfile.dev` 1. Remove any "production", "precompile" instructions 1. Test it with `docker build Dockerfile.dev .` 1. Create a `docker-compose.yml`: version: "3" services: app: build: context: . dockerfile: Dockerfile.dev command: ./bin/rails server -b 0.0.0.0 ports: - "3000:3000" volumes: - .:/rails 1. Configure the rails web console to work in docker in `development.rb`: # Allow IRB in browser for a docker environment config.web_console.permissions = '192.168.0.0/16' -
juanca renamed this gist
Mar 11, 2024 . 1 changed file with 6 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,14 +1,14 @@ 1. Initialize your project folder with git: `git init` 1. Create (and commit) your project files with a temporary ruby image: docker run -it -v .:/rails ruby:3.2.2 /bin/bash cd /rails gem install rails rails new . exit 1. Copy the `Dockerfile` into a new `Dockerfile.dev` 1. Remove any "production", "precompile" instructions 1. Test it with `docker build Dockerfile.dev .` 1. Create a `docker-compose.yml`: version: "3" services: app: -
juanca created this gist
Mar 11, 2024 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,25 @@ 1. Initialize your project folder with git: `git init` 1. Create (and commit) your project files with a temporary ruby image: docker run -it -v .:/rails ruby:3.2.2 /bin/bash cd /rails gem install rails rails new . exit 1. Copy the `Dockerfile` into a new `Dockerfile.dev` 1. Remove any "production", "precompile" instructions 1. Test it with `docker build Dockerfile.dev .` 1. Create a `docker-compose.yml` version: "3" services: app: build: context: . dockerfile: Dockerfile.dev command: ./bin/rails server -b 0.0.0.0 ports: - "3000:3000" volumes: - .:/rails 1. Configure the rails web console to work in docker in `development.rb` # Allow IRB in browser for a docker environment config.web_console.permissions = '192.168.0.0/16'