bibendi / dip Goto Github PK
View Code? Open in Web Editor NEWThe dip is a CLI dev–tool that provides native-like interaction with a Dockerized application.
License: MIT License
The dip is a CLI dev–tool that provides native-like interaction with a Dockerized application.
License: MIT License
dip ssh add
dyld: Library not loaded: /usr/local/opt/bdw-gc/lib/libgc.1.dylib
Referenced from: /usr/local/bin/dip
Reason: image not found
For example in case below BUNDLE_VERSION in command is empty
# dip.yml
environment:
BUNDLE_VERSION: 1.12.5
interaction:
rspec:
service: app
command: bundle exec appraisal bundle _${BUNDLE_VERSION}_ exec rspec
Describe the bug
Currently only .yml
is supported, e.g. dip.yml
and not dip.yaml
.
To Reproduce
dip.yaml
configuration, including the default but renamed to dip.yml
.$ dip ls
ERROR: Could not find dip.yml config
With the following
file: dip.yaml
version: '6.0.0'
environment:
RAILS_ENV: development
compose:
files:
- docker-compose.yml
project_name: higher
interaction:
sh:
description: Open a Bash shell within a Rails container (with dependencies up)
service: runner
command: /bin/bash
bash:
description: Run an arbitrary script within a container (or open a shell without deps)
service: runner
command: /bin/bash
compose_run_options: [no-deps]
bundle:
description: Run Bundler commands
service: runner
command: bundle
compose_run_options: [no-deps]
rake:
description: Run Rake commands
service: runner
command: bundle exec rake
rails:
description: Run Rails commands
service: runner
command: bundle exec rails
subcommands:
s:
description: Run Rails server available at http://localhost:3030
service: rails
compose:
run_options: [service-ports, use-aliases]
yarn:
description: Run Yarn commands
service: runner
command: yarn
compose_run_options: [no-deps]
rspec:
description: Run Rails tests
service: runner
environment:
RAILS_ENV: test
command: bundle exec rspec
rubocop:
description: Run Rubocop
service: runner
command: bundle exec rubocop
compose_run_options: [no-deps]
psql:
description: Run psql console
service: postgres
command: psql -h postgres -U postgres -d example_app_dev
'redis-cli':
description: Run Redis console
service: redis
command: redis-cli -h redis
provision:
- dip compose down --volumes
- dip compose up -d postgres redis
- dip bundle install
- dip yarn install
- dip rails db:setup
The exact same file as dip.yaml
$ dip ls
sh # Open a Bash shell within a Rails container (with dependencies up)
bash # Run an arbitrary script within a container (or open a shell without deps)
bundle # Run Bundler commands
rake # Run Rake commands
rails # Run Rails commands
rails s # Run Rails server available at http://localhost:3030
yarn # Run Yarn commands
rspec # Run Rails tests
rubocop # Run Rubocop
psql # Run psql console
redis-cli # Run Redis console
Expected behavior
Works as it would if said config file was named dip.yml
.
Context (please complete the following information):
Additional context
Add any other context about the problem here.
Describe the bug
I found the following difference in the behaviors between docker-compose and dip.
0.0.0.0:3000->3000/tcp, 0.0.0.0:9229->9229/tcp
To Reproduce
Steps to reproduce the behavior:
Expected behavior
I expect that dip activates the port forwarding configs in docker-compose.yml.
I need to specify the explicit HOST
env as 0.0.0.0
to expose the port for nuxt-app, but this can't be used via dip.
Screenshots
Context (please complete the following information):
(I'm wondering if I took a mistake or something...)
Best regards,
Hello
napolskih$ git diff dip.yml
- DOCKER_RUBY_VERSION: '2.3'
+ DOCKER_RUBY_VERSION: 2.3
napolskih$ dip version
Unhandled exception: Expected String, not 2.3 at line 5, column 24 (YAML::ParseException)
from YAML::Nodes::Scalar@YAML::Nodes::Node#raise<String>:NoReturn
from String::new<YAML::ParseContext, YAML::Nodes::Node+>:String
from Dip::Config#initialize<YAML::ParseContext, YAML::Nodes::Node+, Nil>:(Array(String) | Nil)
from Dip::config:Dip::Config
from Dip::env:Dip::Environment
from __crystal_main
from main
napolskih$ git diff dip.yml
napolskih$ dip version
2.2.1
The fix for #113 broke our own dip.yml
s with no beautiful way to fix it.
We have many command chains in them like command: nvm use 12 && nvm run test
. Since #113, the second part of the command will be executed on the host and not inside the container. Also note that it also breaks any backtick ` as the command will be ran on the host.
entrypoint.sh:
#!/bin/bash
set -e
echo "$@"
eval "$@"
Dockerfile:
FROM ruby:2.7
COPY entrypoint.sh /
ENTRYPOINT ["/entrypoint.sh"]
docker-compose.yml
version: '3.7'
services:
app:
build: .
dip.yml
version: "6"
compose:
files:
- docker-compose.yml
interaction:
test_chain:
service: app
command: pwd && bash -c 'pwd'
test_backquote:
service: app
command: echo `pwd`
All output are created with DIP_ENV=debug
dip 6.1.0
(expected behaviour)dip test_chain
[{}, "docker", ["inspect", "--format", "{{ .NetworkSettings.Networks.frontend.IPAddress }}", "dnsdock"]]
[{"DIP_DNS"=>"127.0.0.11"}, "docker-compose", ["--file", "/Users/pasind/tmp/test_dip/docker-compose.yml", "run", "--rm", "app", "pwd", "&&", "bash", "-c", "pwd"]]
Creating test_dip_app_run ... done
pwd && bash -c pwd
/
/
dip test_backquote
[{}, "docker", ["inspect", "--format", "{{ .NetworkSettings.Networks.frontend.IPAddress }}", "dnsdock"]]
[{"DIP_DNS"=>"127.0.0.11"}, "docker-compose", ["--file", "/Users/pasind/tmp/test_dip/docker-compose.yml", "run", "--rm", "app", "echo", "`pwd`"]]
Creating test_dip_app_run ... done
echo `pwd`
/
dip 7.0.1
(new behaviour)dip test_chain
[{}, "docker inspect --format '{{ .NetworkSettings.Networks.frontend.IPAddress }}' dnsdock"]
[{"DIP_DNS"=>"127.0.0.11"}, "docker-compose --file /Users/pasind/tmp/test_dip/docker-compose.yml run --rm app pwd && bash -c 'pwd'"]
Creating test_dip_app_run ... done
pwd
/
/Users/pasind/tmp/test_dip
dip test_backquote
[{}, "docker inspect --format '{{ .NetworkSettings.Networks.frontend.IPAddress }}' dnsdock"]
[{"DIP_DNS"=>"127.0.0.11"}, "docker-compose --file /Users/pasind/tmp/test_dip/docker-compose.yml run --rm app echo `pwd`"]
Creating test_dip_app_run ... done
echo /Users/pasind/tmp/test_dip
/Users/pasind/tmp/test_dip
There's a workaround that works for us but makes the dip.yml
quite ugly. We could wrap any command in '''original command'''
or "'original command'"
. This work around works both in 6.1
and 7.0
.
The solutions I can see are:
dip.yml
, for an interaction
specifying safe: true
will automatically wrap the command in quotes., a
||or a
&&` in the command and then automatically wrapping.In any case, if we can find a solution that works for everyone I will gladly make the PR for this.
DIP_ENV=debug BOOTSNAP=0 rails s
[{"RAILS_ENV"=>"development", "DISABLE_SPRING"=>"1", "DIP_DNS"=>"127.0.0.11"}, "docker-compose", ["--file", "docker-compose.yml", "up", "-e", "BOOTSNAP=0", "web"]]
-e
is an illegal argument for docker-compose up
.
I'd like to have my description strings be able to access environment variables.
I'd also like to be able to set my other variables, like my database name.
Use case. In my dip.yml file I set a variable that compose uses, which works fine, but I'd like to be able to have the string printed with dip ls reflect that port number, and I'd like to pass in the db name to the pgsql service:
environment:
RAILS_ENV: development
EXPOSED_RAILS_PORT: 3004
DB_NAME:my_db
<snip>
subcommands:
s:
description: Run Rails server available at http://localhost:${EXPOSED_RAILS_PORT}
service: rails
compose:
run_options: [service-ports, use-aliases]
psql:
description: Run psql console
service: postgres
# Because this is a rails project, the name of the database
# (project_dev) is set in config/database.yml
# command: env PGPASSWORD=postgres psql -h postgres -U postgres -d project_dev
command: env PGPASSWORD=postgres psql -h postgres -U postgres -d ${DB_NAME}
This doesn't work now, I believe because the variables set under environment are only used as pass throughs to docker-compose. It would be great if I could access them in my description strings though.
Any thoughts?
Describe the bug
When there is a space in the path to the current working folder, dip provision
fails.
To Reproduce
Steps to reproduce the behaviour:
/tmp/Test Projects/project1
.dip.yml
in the folder:version: '4.1'
compose:
files:
- docker-compose.yml
project_name: test
provision:
- dip compose down
- dip compose up -d
docker-compose.yml
in the folder:version: '3.5'
services:
test:
image: alpine
command: tail -f /dev/null
dip provision
from the folder.Expected behaviour
The container is provisioned without error.
Actual behaviour
The following error is emitted:
No such command: Projects/project1/docker_compose.yml
Screenshots
If applicable, add screenshots to help explain your problem.
Context (please complete the following information):
Additional context
The error is doubly confusing as the file specified is docker-compose.yml
, with a hyphen, and yet the error message mentions docker_compose.yml
with an underscore.
Describe the bug
compose:
files:
Is ignored in dip.override.yml
files
Steps to reproduce
Steps to reproduce the behavior:
# Required minimum dip version
version: '7.0'
environment:
COMPOSE_EXT: dev
compose:
files:
- docker-compose.yml
- docker-compose.$COMPOSE_EXT.yml
dip compose up
from the subfolderExpected behavior
All files listed under the compose files
yml key are used in the docker-compose call
Context (please complete the following information):
This is more a question than a bug report.
I am using DIP version 5.0.0 with the precompiled binary on Linux x86_64.
I have the following project :
dip/
├── subdir/
├── .env
├── dip.yml
└── docker-compose.yml
#.env
TAG=latest
# docker-compose.yml
version: '3.7'
services:
alpine:
image: alpine:$TAG
# dip.yml
version: '5.0.0'
interaction:
test:
service: alpine
command: echo 'test succeeded'
When I use dip
from the root directory (where docker-compose.yml
and dip.yml
files are located) this is works as expected, but I when I use it from subdir/
I get the following error :
$ dip test
WARNING: The TAG variable is not set. Defaulting to a blank string.
ERROR: no such image: alpine:: invalid reference format
I know this is the default behaviour of docker-compose
which looks for a .env
file only in the current working directory. But as a CLI tool, I want to use dip
in various sub-directories.
Is there any way to do this ? Am I doing something wrong ?
The default Image for $ dip nginx
is https://github.com/bibendi/nginx-proxy
Line 22 in 9eb5faf
But, this Image has not been maintained for a long time!
Currently, using this Image generates a malformed /etc/nginx/conf.d/default.conf and nginx -s reload
fails.
We have not been able to determine the cause of the failure, but have confirmed that using the original Image, https://github.com/nginx-proxy/nginx-proxy, eliminates this problem.
Since https://github.com/nginx-proxy/nginx-proxy seems to be actively maintained, why not change it to use this Image by default?
I am aware that it is possible to change the Image used with the --image
option, but I am hoping to change the default Image as I have had difficulty identifying where the problem is originating.
When running the command dip ls
, an NoMethodError
is raised when the interaction
config key is missing from dip.yml:
"undefined method `each_with_object' for nil:NilClass (NoMethodError)"
Steps to reproduce the behavior:
version: '5'
compose:
files:
- docker-compose.yml
version: '3.7'
services:
app:
build:
context: .
dockerfile: Dockerfile
dip ls
Traceback (most recent call last):
12: from /Users/br3nt/.rvm/gems/ruby-2.6.3/bin/ruby_executable_hooks:24:in `<main>'
11: from /Users/br3nt/.rvm/gems/ruby-2.6.3/bin/ruby_executable_hooks:24:in `eval'
10: from /Users/br3nt/.rvm/gems/ruby-2.6.3/bin/dip:23:in `<main>'
9: from /Users/br3nt/.rvm/gems/ruby-2.6.3/bin/dip:23:in `load'
8: from /Users/br3nt/.rvm/gems/ruby-2.6.3/gems/dip-5.0.0/exe/dip:23:in `<top (required)>'
7: from /Users/br3nt/.rvm/gems/ruby-2.6.3/gems/dip-5.0.0/lib/dip/cli.rb:31:in `start'
6: from /Users/br3nt/.rvm/gems/ruby-2.6.3/gems/thor-1.0.1/lib/thor/base.rb:485:in `start'
5: from /Users/br3nt/.rvm/gems/ruby-2.6.3/gems/thor-1.0.1/lib/thor.rb:392:in `dispatch'
4: from /Users/br3nt/.rvm/gems/ruby-2.6.3/gems/thor-1.0.1/lib/thor/invocation.rb:127:in `invoke_command'
3: from /Users/br3nt/.rvm/gems/ruby-2.6.3/gems/thor-1.0.1/lib/thor/command.rb:27:in `run'
2: from /Users/br3nt/.rvm/gems/ruby-2.6.3/gems/dip-5.0.0/lib/dip/cli.rb:47:in `ls'
1: from /Users/br3nt/.rvm/gems/ruby-2.6.3/gems/dip-5.0.0/lib/dip/commands/list.rb:10:in `execute'
/Users/br3nt/.rvm/gems/ruby-2.6.3/gems/dip-5.0.0/lib/dip/interaction_tree.rb:35:in `list': undefined method `each_with_object' for nil:NilClass (NoMethodError)
Expected behavior
It would be nice a message was displayed letting me know I was missing a required config key.
Hi!
Awesome project! Trying to set it up on my rails 6 app. Everything works fine except when I try to debug with byebug or pry
and when I try to write something to the logs ex; puts "lol" * 100
nothing happens.
Am I missing some configuration steps to make this work?
Thanks
Describe the bug
dip
fails with the breaking changes in the newer psych 4.0.0 gem:
To Reproduce
Steps to reproduce the behavior:
gem update psych
dip ls
.$ dip sh
/Users/<username>/.config/anyenv/envs/rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/psych-4.0.0/lib/psych.rb:322:in `safe_load': wrong number of arguments (given 4, expected 1) (ArgumentError)
from /Users/<username>/.config/anyenv/envs/rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/dip-7.1.0/lib/dip/config.rb:65:in `load_yaml'
from /Users/<username>/.config/anyenv/envs/rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/dip-7.1.0/lib/dip/config.rb:107:in `config'
from /Users/<username>/.config/anyenv/envs/rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/dip-7.1.0/lib/dip/config.rb:90:in `block (2 levels) in <class:Config>'
from /Users/<username>/.config/anyenv/envs/rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/dip-7.1.0/lib/dip/cli.rb:27:in `start'
from /Users/<username>/.config/anyenv/envs/rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/dip-7.1.0/exe/dip:23:in `<top (required)>'
from /Users/<username>/.anyenv/envs/rbenv/versions/3.0.1/bin/dip:23:in `load'
from /Users/<username>/.anyenv/envs/rbenv/versions/3.0.1/bin/dip:23:in `<main>'
The symptom is not related with the configs in dip.yml or docker-compose.yml.
Expected behavior
Any dip
commands should work with psych 4.0.0.
Actually, just running gem uninstall psych
resolves the issue because psych 3.3.0 is a "default gem" in the current Ruby 3.0.1p64.
$ gem uninstall psych
$ gem list|grep psych
psych (default: 3.3.0)
Context (please complete the following information):
Additional context
I guess there might occur some more fixes or changes regarding psych breaking changes. The situation might be in fluid.
https://bugs.ruby-lang.org/issues/17866
Rails has also been affected by the changes in psych:
For example, I have compose file:
› cat docker-compose.yml
version: '2'
services:
web:
build: '.'
command: 'bash -c "bundle exec hanami server -p 3000 --host 0.0.0.0"'
environment:
- SSH_AUTH_SOCK=/ssh/auth/sock
ports:
- '3000:3000'
volumes:
- '.:/app'
- ssh-data:/ssh:ro
depends_on:
- db
and dip.yml
...
hanami:
service: web
subcommands:
server:
service: web
If i run server through dip:
DIP_DEBUG=1 dip hanami server
"docker-compose --file docker-compose.yml --project-name auto run -e HANAMI_ENV=development --rm web"
b1596b2a4c43 auto "bash -c 'bundle exec" 2 days ago Up 2 seconds 3000/tcp auto_web_run_1
Port mapping not work.
For simple applications which don't use dns we should allow run app server with port mapping.
compose command should be with --service-ports
docker-compose --file docker-compose.yml --project-name auto run -e HANAMI_ENV=development --service-ports --rm web
4c90c609da55 auto "bash -c 'bundle exec" 2 days ago Up 4 seconds 0.0.0.0:3000->3000/tcp auto_web_run_1
maybe we should use special option in dip.yml ports: true
?
hanami
service: web
subcommands:
server:
service: web
ports: true
What do u think?
This release broke it -
$ dip ssh add
ssh_data
Conflicting options: --rm and -d
Is it possible to have containers started via dip, remove themselves once they're finished with?
If I understand docker(-compose) well enough, then I'm thinking something like the --rm
flag.
I guessed it might be possible to configure via the dip.yml
file, something like:
compose_run_options: [rm]
But this doesn't work
Thanks.
2 Enhancement Requests:
Do not replace non-environment variables in provisioning commands.
For example, in this dip.yml
: The first provision command outputs:
[email protected]:organization/repo.git [email protected]:organization/repo2.git
repo name:
repo name:
I've debugged it quite thoroughly and it seems that the interpolation step here and subsequently here replaces all variables with their corresponding environment variable first from the yml, then the environment if it exists, else it gets replaced with a blank string (hence why $REPOS
is correctly replaced, but $repo
is blank). This should instead only replace the variable if an environment variable has been explicitly declared.
This would allow one to offload a good bit of setup logic into dip's provisioning functionality. I have this dip.yml at the root of my projects, and a simple dip provision
could bring everything up for me without having to create a bunch of shell scripts, if this were to work.
Allow generalized, folder-specific command aliases
One of my favorite features of dip is its ability to dynamically alias commands when a dip.yml file is found. I'd like to be able to add additional aliases that do not reference a specific docker-compose service. In the example above, you can see I've stubbed out what I'd imagine it to look something like under "interaction". Currently running this command results in a lib/dip/interaction_tree.rb:61:in 'fetch': key not found: :service
error since the service key is not found.
I would love to be able to use dip for all my project-specific aliases, and not just docker-compose ones (the goal is for it to feel native, right? 💯 ). If this were to work, I could run a simple dip start
to bring up both nginx and dns, as well as anything else necessary for the environment to function!
P.S. While I'm not a Ruby dev, I'm loving dip so far. It's encapsulated a lot of my ideal workflow and tooling when working in a multi-project Docker environment. Great work on this! I'm hoping to be able to adopt this or a flavor of it into our company's workflow. I'd love to see some more documentation around the capabilities of it if you ever find the time!
Version: 3.8.2 (MacOS binary).
Environment variables specified under interaction -> [service] -> environment
are not passed to container.
Example:
interaction:
service: app
environment:
SAMPLE: 42
command: echo
Expected:
$ dip echo $SAMPLE
42
Actual:
$ dip echo $SAMPLE
Describe the bug
Not really a bug, more of a feature request
Allow dip to dip install
the newest files needed for dip to run and manage itself:
A simpler way of kicking of dip in a new project as I caught myself setting up a new project via:
cp -r ../some-other-project/.dockerdev .
cp ../some-other-project/dip.yml .
cp ../some-other-project/docker-compose.yml .
To Reproduce
Steps to reproduce the behavior:
Expected behavior
dip install
gives me
.dockerdev
folderdocker-compose.yml
the latest and greatest versiondip.yml
the latest and greatestScreenshots
If applicable, add screenshots to help explain your problem.
Context (please complete the following information):
Additional context
I agree this has some RTFM to it, as I would be able to start from the latest and greatest by searching around a little, but still, I think this would make for a great extension of an already great 🚀 gem.
Thanks for Dip. Saved me having to customise various plug-ins to wrap Docker Compose commands.
Does Dip run a new container each time? If so, is it possible to run a new container if doesn't exist and then exec afterwards to boost performance?
When I run dip run
command, it only accept two options currently: -p and -e options.
On the original docker-compose, there are other options to use like -d, -u, -v, etc.
Can you support these options?
I tried to install precompiled binary in Arch Linux system:
What i did:
❯ sudo su
alexey-pc# curl -L https://github.com/bibendi/dip/releases/download/3.8.3/dip-`uname -s`-`uname -m` > /usr/local/bin/dip
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 9 0 9 0 0 7 0 --:--:-- 0:00:01 --:--:-- 7
alexey-pc# exit
❯ sudo chmod +x /usr/local/bin/dip
What I have:
❯ dip --help
/usr/local/bin/dip: line 1: Not: command not found
Could I do something wrong?
I don't want to stop the posgres and such, just want to kick the rails process.
The rails service has a dependency on postgres so that adds a layer of complexity as well.
Thanks.
Describe the bug
Since 7.1.2 (It works with 7.1.1) if a command is declared as shell: false
it will fail if given any argument.
Here is the stacktrace:
Traceback (most recent call last):
9: from /Users/pasind/.rvm/gems/ruby-2.7.4@shotgun/gems/dip-7.1.2/exe/dip:23:in `<main>'
8: from /Users/pasind/.rvm/gems/ruby-2.7.4@shotgun/gems/dip-7.1.2/lib/dip/cli.rb:31:in `start'
7: from /Users/pasind/.rvm/gems/ruby-2.7.4@shotgun/gems/thor-0.20.3/lib/thor/base.rb:466:in `start'
6: from /Users/pasind/.rvm/gems/ruby-2.7.4@shotgun/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
5: from /Users/pasind/.rvm/gems/ruby-2.7.4@shotgun/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
4: from /Users/pasind/.rvm/gems/ruby-2.7.4@shotgun/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
3: from /Users/pasind/.rvm/gems/ruby-2.7.4@shotgun/gems/dip-7.1.2/lib/dip/cli.rb:85:in `run'
2: from /Users/pasind/.rvm/gems/ruby-2.7.4@shotgun/gems/dip-7.1.2/lib/dip/commands/run.rb:30:in `execute'
1: from /Users/pasind/.rvm/gems/ruby-2.7.4@shotgun/gems/dip-7.1.2/lib/dip/commands/run.rb:59:in `compose_arguments'
/Users/pasind/.rvm/gems/ruby-2.7.4@shotgun/gems/dip-7.1.2/lib/dip/commands/run.rb:84:in `get_args': undefined local variable or method `default_args' for #<Dip::Commands::Run:0x00007f939d82d628> (NameError)
To Reproduce
Steps to reproduce the behavior:
compose:
files:
- ./docker-compose.yml
interaction:
rvm:
description: Start rvm in the app container
service: app_dev
command: rvm
shell: false
Provide docker-compose.yml
Not really relevant. I can provide one if needed.
Run command
dip rvm install 2.7.4
See error
Expected behavior
Should work.
Screenshots
The second dip
command is using 7.1.1
Context (please complete the following information):
Hi,
Was wondering if it would be possible to interpolate
We have scripts that we need to run for our dev env that developers don't really need to understand (other members of the team not knowledgeable about the tech). One example here is that we need to add a script to a container temporarily (not defined as a volume in the docker-compose) for the duration of the script. We can use the -v (https://docs.docker.com/compose/reference/run/) for mounting a volume with docker-compose but that only works if you give it an absolute path. It cannot work with relatives paths and we are trying todo the following.
truncate for clarity
vault_setup:
description: Setup the vault
service: vault
command: /bin/sh
compose_run_options:
[
no-deps,
use-aliases,
"-e VAULT_ADDR=https://host.docker.internal:8200",
"-e VAULT_SKIP_VERIFY=true",
"-v ${DIP_WORK_DIR_REL_PATH}/vault/init.file:/vault/init.file:ro"
]
what does work if we provide it the full path: (but that is hard to spread across the team cause those paths are not going to be the same)
vault_setup:
description: Setup the vault
service: vault
command: /bin/sh
compose_run_options:
[
no-deps,
use-aliases,
"-e VAULT_ADDR=https://host.docker.internal:8200",
"-e VAULT_SKIP_VERIFY=true",
"-v /Users/some_path/vault/init.file:/vault/init.file:ro"
]
So is there a way that you think off that would allow use to interpolate something in the run_options?
Is there a way to use the 7+ version for non-ruby project?
The doc uses 127.0.0.1
for *.docker
.
dip/docs/docker-for-mac-install.md
Lines 15 to 28 in 3e5f464
Background: I have valet (think puma-dev for php) installed which occupies 127.0.0.1
. Following the steps in the docs, my dip-rails.docker
resolved to valet.
Tried to use 127.0.123.1
and 172.17.0.1
(as in https://github.com/aacebedo/dnsdock/blob/1b558dc15527c149fc540f8934116e7791a8b994/readme.md#L291-L294). dip-rails.docker
failed to resolve to docker in both cases (ERR_NAME_NOT_RESOLVED
).
Question: How to customize resolver IP?
Thanks!!!
Hey all,
First, thank you for building this helpful tool that makes my life a bit easier. Second, my apologies for asking this question as Github issue - I didn't know if I should go pester people on Twitter or not 😄 .
I'd like to automatically provide arguments to dip compose
- specifically, I'd like to have the flags set true for Docker's buildkit
commands: COMPOSE_DOCKER_CLI_BUILD=1
and DOCKER_BUILDKIT=1
. That way, whenever I run dip compose build
, it will automatically add DOCKER_BUILDKIT=1
.
Thanks for any and all help.
First and foremost, thanks for the great tool. It makes working with docker so much more enjoyable.
Describe the bug
I attempt to use dip nginx up
along with setting the VIRTUAL_HOST
, VIRTUAL_PATH
, and VIRTUAL_PORT
environment variables on the rails
service. I also added the networks
as shown in the example for the frontend
and default
networks. Whenever I try to connect to the hostname I used it doesn't seem to work. I either get a 503 Service Temporarily Unavailable
response from nginx. The logs show the request if I do curl -H "Host: companycam.local" localhost
but it doesn't actually send it to my app.
To Reproduce
Steps to reproduce the behavior:
version: "4.1"
environment:
RAILS_ENV: development
compose:
files:
- docker-compose.yml
project_name: companycam
interaction:
sh:
description: Open a Bash shell within a Rails container (with dependencies up)
service: runner
command: /bin/bash
bash:
description: Open a Bash shell
service: runner
command: /bin/bash
compose_run_options: [no-deps]
guard:
description: Run guard
service: runner
environment:
RAILS_ENV: test
KMS_KEY_ID: insecure-test-key
GENIUS_SCAN_KEY: test-key
command: bundle exec guard
bundle:
description: Run Bundler commands
service: runner
command: bundle
yarn:
description: Run Yarn commands
service: runner
command: yarn
rake:
description: Run Rake commands
service: runner
command: bundle exec rake
rails:
description: Run Rails commands
service: runner
command: bundle exec rails
subcommands:
s:
description: Run Rails server available at http://localhost:3000
service: rails
compose:
run_options: [service-ports, use-aliases]
sidekiq:
description: Run Sidekiq worker
service: runner
command: bundle exec sidekiq
rspec:
description: Run RSpec commands within test environment
service: runner
environment:
RAILS_ENV: test
KMS_KEY_ID: insecure-test-key
GENIUS_SCAN_KEY: test-key
command: bundle exec rspec
rubocop:
description: Lint ruby files
service: runner
command: bundle exec rubocop
compose:
run_options: [no-deps]
dev_prime:
description: Setup the local databases with some default data
service: runner
command: bundle exec rails dev:prime
psql:
description: Open a Postgres console
service: postgis
default_args: companycam_development
command: psql -h postgis -U postgres
mongo:
description: Open a Mongo console
service: mongo
command: mongo --host mongodb://mongo:27017/companycam_development
provision:
- dip compose down --volumes --remove-orphans
- dip compose up -d
- dip bundle install
- dip yarn install
- dip rails db:create
- dip rails db:environment:set RAILS_ENV=${RAILS_ENV}
- dip rails db:schema:load
- dip rails db:migrate
- dip rails db:create_indexes
version: "2.4"
x-app: &app
build:
context: .dockerdev
dockerfile: Dockerfile
args:
RUBY_VERSION: "2.5.7"
PG_MAJOR: "10"
NODE_MAJOR: "10"
YARN_VERSION: "1.22.5"
BUNDLER_VERSION: "2.1.4"
volumes:
- .:/app:cached
- bundle:/bundle
environment: &env
NODE_ENV: development
RAILS_ENV: ${RAILS_ENV:-development}
NPM_TOKEN: "${NPM_TOKEN}"
BUNDLER_VERSION: "2.1.4"
image: companycam-dev:0.0.1
tmpfs:
- /tmp
x-backend: &backend
<<: *app
stdin_open: true
tty: true
volumes:
- .:/app:cached
- rails_cache:/app/tmp/cache
- bundle:/bundle
- node_modules:/app/node_modules
- packs:/app/public/packs
- .dockerdev/.psqlrc:/root/.psqlrc:ro
environment:
<<: *env
BOOTSNAP_CACHE_DIR: /bundle/bootsnap
WEBPACKER_DEV_SERVER_HOST: webpacker
MALLOC_ARENA_MAX: 2
WEB_CONCURRENCY: ${WEB_CONCURRENCY:-2}
HISTFILE: /app/log/.bash_history
PSQL_HISTFILE: /app/log/.psql_history
EDITOR: vim
REDIS_URL: redis://redis:6379/0
KMS_KEY_ID: ${KMS_KEY_ID}
SIDEKIQ_REDIS_URL: redis://redis:6379/1
REDIS_OBJECTS_URL: redis://redis:6379/2
SEARCHKICK_REDIS_URL: redis://redis:6379/3
RACK_THROTTLE_REDIS_URL: redis://redis:6379/4
GRAPHQL_REDIS_URL: redis://redis:6379/5
DATABASE_URL: postgres://postgres:postgres@postgis:5432/companycam_${RAILS_ENV:-development}
EVENTS_DATABASE_URL: postgres://postgres:postgres@postgis:5432/events_${RAILS_ENV:-development}
MONGO_URL: "mongodb://mongo:27017/companycam_${RAILS_ENV:-development}"
ELASTICSEARCH_URL: http://elasticsearch:9200
VIRTUAL_HOST: '*.companycam.local'
VIRTUAL_PATH: '/'
VIRTUAL_PORT: '3000'
depends_on:
postgis:
condition: service_healthy
redis:
condition: service_started
memcached:
condition: service_started
mongo:
condition: service_healthy
elasticsearch:
condition: service_healthy
services:
runner:
<<: *backend
command: /bin/bash
ports:
- "3002:3002"
rails:
<<: *backend
command: bundle exec rails server -b 0.0.0.0
ports:
- "3000:3000"
networks:
- default
- frontend
dns: $DIP_DNS
sidekiq:
<<: *backend
command: bundle exec sidekiq -C config/sidekiq.yml
webpacker:
<<: *app
command: ./bin/webpack-dev-server
ports:
- "3035:3035"
volumes:
- .:/app:cached
- rails_cache:/app/tmp/cache
- bundle:/bundle
- node_modules:/app/node_modules
- packs:/app/public/packs
environment:
<<: *env
WEBPACKER_DEV_SERVER_HOST: 0.0.0.0
BOOTSNAP_CACHE_DIR: /bundle/bootsnap
postgis:
image: mdillon/postgis:10
volumes:
- .psqlrc:/root/.psqlrc:ro
- postgis:/var/lib/postgresql/data
environment:
PSQL_HISTFILE: /root/log/.psql_history
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
POSTGRES_DB: companycam_development
ports:
- "5432"
healthcheck:
test: pg_isready -U postgres -h 127.0.0.1 -d companycam_development
interval: 5s
mongo:
image: mongo
restart: always
ports:
- "27017:27017"
environment:
MONGO_INITDB_DATABASE: companycam_development
volumes:
- mongodb:/data/db
healthcheck:
test: echo 'db.runCommand("ping").ok' | mongo localhost:27017/companycam_development --quiet
interval: 5s
memcached:
image: memcached
ports:
- "11211"
healthcheck:
disable: true
# test: memcached-tool 127.0.0.1:11211 stats
# interval: 3s
# timeout: 3s
# retries: 30
redis:
image: redis:5.0-alpine
ports:
- 6379
volumes:
- redis:/data
healthcheck:
test: redis-cli ping
interval: 1s
timeout: 3s
retries: 30
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:6.8.13
ports:
- "9200:9200"
volumes:
- elasticsearch:/usr/share/elasticsearch/data
environment:
- cluster.name=docker-cluster
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
- xpack.security.enabled=false
healthcheck:
test: ["CMD", "curl", "http://localhost:9200/_cat/health"]
interval: 1s
timeout: 3s
retries: 30
volumes:
postgis:
mongodb:
redis:
elasticsearch:
bundle:
node_modules:
rails_cache:
packs:
networks:
frontend:
external:
name: frontend
dip ngnix up
dip rails s
Expected behavior
A clear and concise description of what you expected to happen.
I am able to connect to companycam.local and see the app.
Context (please complete the following information):
Additional Context
I am running puma-dev presently as we are preparing for the docker switch. I believe that runs on port 80, so not sure if that would conflict since it seems that nginx is receiving the request.
Need help from a native speaker.
Hello! Please add ability to mount /etc/nginx/proxy.conf for adding custom settings as here https://github.com/jwilder/nginx-proxy#proxy-wide
After a docker update (i am on osx) it turned on Docker compose V2 by default (see https://docs.docker.com/compose/cli-command/). After turning it off stuff started working again. Any idea if this is in the pipeline of being supported?
Sorry, being a bit of a dumb user here. Could you explain whether/how I can use SSH commands from within dip shell?
background: I use dip to manage a number of Rails sites all with slightly different hosting (not by me, I inherited them!). For each site I have a 'livepull' command that does a postgres dump of the production db, downloads it, and restores into a dev db for investigating problems. This plays nicely with Heroku. For some sites, I have a .sh file to SSH in and issue a pg_dump command, then SFTP the file locally, and run a pg_restore.
Can I run "SSH [email protected] << EOF pg_dump ....., exit EOF" in dip shell? If I do a 'dip ssh up' first?
Hello 👋
Tried running dip build
thinking it will directly do a docker-compose build command.
There is the possibility to do it through dip compose build
but dip build
was a natural step for me to do after seeing that many commands on the first level of semantic hirarchy are already docker related [up, down, stop]
just started using your tool as a replacement for make :) really cool 😄
I could try to implement it if you think is worth the investment and sharing :D
After each reboot on -
dip ssh add
Im getting this error:
$ dip ssh add
ssh_data
docker: Error response from daemon: Conflict. The name "/ssh-agent" is already in use by container b86a6ef522e1470b39f8ed9eb8e2e375085a1966db95d305b001a20368e5c175. You have to remove (or rename) that container to be able to reuse that name..
See 'docker run --help'.
And, therefore, I required to remove this container manually.
OS:
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.1 LTS
Release: 16.04
Codename: xenial
docker and docker-compose:
$ docker -v
Docker version 1.12.1, build 23cf638
$ docker-compose -v
docker-compose version 1.8.0, build f3628c7
I think problem here - https://github.com/bibendi/dip/blob/master/src/dip/commands/ssh.cr#L28.
You should run docker start ssh-agent
if container already exists.
Or, maybe better set ssh-agent container to 'restart always' ?
Hi,
Thnx for releasing the latest (7.0) version today. I see that the compiled binary is not longer there and i guess that also means we cannot longer install dip with brew?
We can get along with installing the gem but the problematic part in that is that we will need to have ruby installed first on the dev machines and not all our people are ruby minded (frontend devs). Do you think it would be possible to run dip inside a container and would behave like it was installed on the host machine? From my understanding that will be hard cause did will execute docker stuff in the context of the container then and not the host.
Just want to explore the possible alternatives for the decision to not build a compiled binary.
As far as I can tell, the only way to ignore an environment variable within dip is to add it to the DIP_EARLY_ENV
environment variable. This is a reasonable heuristic for what to ignore, but it means that there is an order-dependence to your shell configuration.
What I found is that since I use chruby, which modifies the GEM_HOME
and GEM_PATH
environment variables, my dip
-run containers were not picking up the bundle in my Docker volume and were thus not working.
The reason for that is that my eval "$(dip console)"
was being run prior to chruby initializing.
It would be really nice if dip
had the ability to allowlist/denylist environment variables to use within the containers. Something like:
environment:
allowed:
- BUNDLE_GITHUB__COM
- RAILS_MASTER_KEY
or
environment:
denied:
- GEM_HOME
- GEM_PATH
I'd be happy to take a crack at an approach if you want.
Aside
I'm not really sure what the current behavior is meant for since docker-compose
already handles the environment variables that I need within my project. Why do you pass all environment variables in, instead of relying on docker-compose
to manage the environment for you?
Describe the bug
We're setting up a subcommand which will automatically import a .sql file into mysql running inside a container. This contains the <
symbol, as that required to import the dump, but this doesn't seem to work within the dip context.
To Reproduce
Steps to reproduce the behaviour:
# dip.yml
mysql:
description: Run mysql console
service: mysql
command: mysql -h mysql_no -u root -d app_development
subcommands:
import:
description: import the specified file into the development database
service: mysql
command: mysql -h mysql -u root -proot app_development < MySQL.sql
# command run
$ dip mysql import
# Output
mysql: [Warning] Using a password on the command line interface can be insecure.
mysql Ver 14.14 Distrib 5.7.33, for Linux (x86_64) using EditLine wrapper
Copyright (c) 2000, 2021, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Usage: mysql [OPTIONS] [database]
-?, --help Display this help and exit.
-I, --help Synonym for -?
snip...
We've been able to bypass this by removing the < MySQL.sql
portion of the command, and instead passing that in via the CLI when we run the command, i.e. dip mysql import < MySQL.sql
- but would prefer for it to be all inclusive within the dip.yml
file.
Expected behavior
It should import the database
Context (please complete the following information):
hi @bibendi ,
I recently saw your commits in my coveralls.io account:
I also opened issue: lemurheavy/coveralls-public#909
FYI.
First of all, thank you for the really great, useful and handy tool. I apologize in advance for possible grammar mistakes. Also, I assume I might misunderstand the actual reason of the issue.
Describe the bug
It's impossible to use a container application with arguments on Ubuntu and therefore it's impossible to use advanced shell constructions.
To Reproduce
Steps to reproduce the behavior:
/tmp/test_project
dip.yml
config file in the folder:version: '2'
compose:
files:
- docker-compose.yml
interaction:
bash:
service: test
command: /bin/sh
provision:
- dip bash -c 'if [[ true ]]; then echo works; fi'
docker-compose.yml
config file in the folder:version: '3.5'
services:
test:
image: alpine
command: tail -f /dev/null
dip provision
or dip bash -c 'if [[ true ]]; then echo works; fi'
from the folder.sh: -c: line 1: syntax error near unexpected token `then'
sh: -c: line 1: `docker-compose --file /home/snthpr1d3/work/dip_bug/docker-compose.yml run --rm test /bin/sh -c if [[ true ]]; then echo works; fi'
ERROR: Command 'dip bash -c 'if [[ true ]]; then echo works; fi'' executed with error
Expected behavior
Performs the shell command correctly and prints "works" as on MacOS environment.
Context (please complete the following information):
Additional context
Don't reproduce on MacOS environment.
As you can see the dip bash -c 'if [[ true ]]; then echo works; fi
sample command transcripts into
docker-compose --file /home/snthpr1d3/work/dip_bug/docker-compose.yml run --rm test /bin/sh -c if [[ true ]]; then echo works; fi
which is evidently requires quotes to surround the arguments like this
docker-compose --file /home/snthpr1d3/work/dip_bug/docker-compose.yml run --rm test /bin/sh -c 'if [[ true ]]; then echo works; fi'
as it was in the original config file: dip bash -c 'if [[ true ]]; then echo works; fi'
As I mentioned before, works correctly on MacOS.
Hello,
can I pass variables to dip manually not in interactive mode?
For example, I would like to run rake db:migrate
in different environments. So, I made
docker-compose.yml
services:
web:
environment:
-HANAMI_ENV=${ENV}
and
dip.yml
environment:
ENV: ${ENV}
And then I tried dip ENV=test bundle exec rake db:migrate
, but dip don't accept variable.
Also, as I understand, you make anything like this in https://github.com/bibendi/dip#dip-run
dip version: 3.8.2, binary; Ubuntu 18.04
Add default stack files.
stacks:
- ruby
- rails
- postgres
- mysuperstack:
source: github.com/user/repo/path_to_mysuperstack.yml
interaction:
services:
app:
stacks:
- ruby
- rails
tasks:
rebuild:
command: dip bundle exec rake rebuild
pg:
stacks:
- postgres
superservice:
stacks:
- mysuperstack
dip stacks install
It will download yml files:
And place it to ~/.dip/stacks/
Example of ruby.yml stack:
irb:
command: irb
bundle:
command: bundle
rake:
command: bundle exec rake
Hi, I have defined a rails
dip command so to run tests with an environment configured with docker-compose. However it starts a new container each time, so startup is slow. How can I use an existing container if I run docker-compose up
beforehand? Compose starts the container with name app-test
, but dip starts a new container named app-rails
with the name of the command in it. I tried setting container_name: app-test
in the dip command but nothing changes. Thanks in advance
Hi! I am loving this utility, it makes it easier to work with Docker. I have a quick question: can I somehow hide / remove the "Starting X" messages when running a command, so it looks like that command is not from docker compose/dip? Thanks!
Describe the bug
The following error occurred in https://github.com/bibendi/dip/releases/tag/v7.0.0.
$ dip --version
7.0.0
$ dip dns ip
Template parsing error: template: :1: unexpected unclosed action in command
ERROR: Command 'docker inspect --format {{ .NetworkSettings.Networks.frontend.IPAddress }} dnsdock' executed with error.
Therefore, DIP_DNS
is not set and requests between containers will not work.
To Reproduce
Steps to reproduce the behavior:
$ docker network ls
NETWORK ID NAME DRIVER SCOPE
a51e8bb8a1a5 bridge bridge local
ea175032c0fb host host local
f3e5cf88a3a5 none null local
$ docker container ls -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
$ dip dns up
e40f1db441cad1383d8a1b8b65e46d137c2578588c7407772f9de186839e36e6
9f30d003f9df0cf2af4b4ac3476c3677a23fffd131d6054f3ba2906cff096056
$ docker network ls
NETWORK ID NAME DRIVER SCOPE
a51e8bb8a1a5 bridge bridge local
e40f1db441ca frontend bridge local
ea175032c0fb host host local
f3e5cf88a3a5 none null local
$ docker container ls -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
9f30d003f9df aacebedo/dnsdock:latest-amd64 "dnsdock --domain=do…" 26 minutes ago Up 26 minutes 0.0.0.0:56519->53/udp dnsdock
$ docker network inspect frontend
[
{
"Name": "frontend",
"Id": "e40f1db441cad1383d8a1b8b65e46d137c2578588c7407772f9de186839e36e6",
"Created": "2021-04-10T02:38:13.757056728Z",
"Scope": "local",
"Driver": "bridge",
"EnableIPv6": false,
"IPAM": {
"Driver": "default",
"Options": {},
"Config": [
{
"Subnet": "172.20.0.0/16",
"Gateway": "172.20.0.1"
}
]
},
"Internal": false,
"Attachable": false,
"Ingress": false,
"ConfigFrom": {
"Network": ""
},
"ConfigOnly": false,
"Containers": {
"9f30d003f9df0cf2af4b4ac3476c3677a23fffd131d6054f3ba2906cff096056": {
"Name": "dnsdock",
"EndpointID": "9da2d80f6e762104d27086eb31270f25ddedc710ac5f4c4cb3d500ed24216947",
"MacAddress": "02:42:ac:14:00:02",
"IPv4Address": "172.20.0.2/16",
"IPv6Address": ""
}
},
"Options": {},
"Labels": {}
}
]
$ dip --version
7.0.0
$ dip dns ip
Template parsing error: template: :1: unexpected unclosed action in command
ERROR: Command 'docker inspect --format {{ .NetworkSettings.Networks.frontend.IPAddress }} dnsdock' executed with error.
Expected behavior
No error in v6.1.0.
$ dip --version
6.1.0
$ dip dns ip
172.20.0.2
Context:
$ sw_vers
ProductName: Mac OS X
ProductVersion: 10.15.7
BuildVersion: 19H524
$ docker -v
Docker version 20.10.5, build 55c4c88
$ dip --version
7.0.0
$ bash --version
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin19)
Copyright (C) 2007 Free Software Foundation, Inc.
Additional context
I think this commit is the cause.
71baf4e
$ docker inspect --format {{ .NetworkSettings.Networks.frontend.IPAddress }} dnsdock
Template parsing error: template: :1: unexpected unclosed action in command
$ docker inspect --format '{{ .NetworkSettings.Networks.frontend.IPAddress }}' dnsdock
172.20.0.2
$ ruby -v
ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-darwin19]
$ ruby -e "::Kernel.system({}, 'docker', 'inspect', '--format', '{{ .NetworkSettings.Networks.frontend.IPAddress }}', 'dnsdock')"
172.20.0.2
$ ruby -e "::Kernel.system({}, 'docker inspect --format {{ .NetworkSettings.Networks.frontend.IPAddress }} dnsdock')"
Template parsing error: template: :1: unexpected unclosed action in command
I have some requirements, I want to use one command to execute multiple interactions
For example I have a dip.yml like this
interaction:
rails:
description: Run Rails commands
service: rails
command: bundle exec rails
subcommands:
s:
description: Run Rails server
service: rails
compose:
run_options: [service-ports, use-aliases]
yarn:
description: Run Yarn commands
service: rails
command: yarn
compose_run_options: [no-deps]
I want to use one command like dip start-server
。It can run like provision to run
- dip rails s
- dip yarn start
Can I make it happen?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.