Code Monkey home page Code Monkey logo

fabricio's People

Contributors

renskiy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fabricio's Issues

Transparent proxy over SSH tunnel

The idea is to forward outgoing registry requests (80 and 443 ports) to SSH tunnel with proxy in transparent mode (e.g. squid) on the other side of tunnel.

Forwarding can be set up with iptables:

iptables --table nat --append OUTPUT --protocol tcp --dport 80 --dport 443 --jump DNAT --to-destination 127.0.0.1:3128

Transparent proxy may be started on the admin side as a Docker container.

PS: don't forget to reset iptables rules to original state after all. This can be reached by following steps: reset => set => reset, where first step need to be sure there is no any rules from previous (possibly failed) deploy.

Make Fabricio work on Windows

There is at least one place where used bash-specific command which can not be executed by default on Windows: DockerTasks.delete_dangling_images().

DockerTasks.update(): fabric.api.remote_tunnel fails with exception when no actual host found

Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/fabric/main.py", line 745, in main
    *args, **kwargs
  File "/Library/Python/2.7/site-packages/fabric/tasks.py", line 427, in execute
    results['<local-only>'] = task.run(*args, **new_kwargs)
  File "/Library/Python/2.7/site-packages/fabric/tasks.py", line 174, in run
    return self.wrapped(*args, **kwargs)
  File "/Library/Python/2.7/site-packages/fabricio/tasks.py", line 105, in update
    local_host=self.local_registry_host,
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 17, in __enter__
    return self.gen.next()
  File "/Library/Python/2.7/site-packages/fabric/context_managers.py", line 554, in remote_tunnel
    transport = connections[env.host_string].get_transport()
  File "/Library/Python/2.7/site-packages/fabric/network.py", line 158, in __getitem__
    if key not in self:
  File "/Library/Python/2.7/site-packages/fabric/network.py", line 173, in __contains__
    return dict.__contains__(self, normalize_to_string(key))
  File "/Library/Python/2.7/site-packages/fabric/network.py", line 397, in normalize_to_string
    return join_host_strings(*normalize(host_string))
  File "/Library/Python/2.7/site-packages/fabric/network.py", line 387, in join_host_strings
    template = "%s@[%s]:%s" if host.count(':') > 1 else "%s@%s:%s"
AttributeError: 'NoneType' object has no attribute 'count'

denied: requested access to the resource is denied

During installation encountered the following error:

fabricio.operations.Error: local() encountered an error (return code 1) while executing 'docker push...

Environment:
Mac OS 10.x
Fabric==1.14.0
fabricio==0.5.6

denied: requested access to the resource is denied

Traceback (most recent call last):
File "/usr/local/lib/python2.7/site-packages/fabric/main.py", line 757, in main
*args, **kwargs
File "/usr/local/lib/python2.7/site-packages/fabric/tasks.py", line 426, in execute
results[''] = task.run(*args, **new_kwargs)
File "/usr/local/lib/python2.7/site-packages/fabric/tasks.py", line 173, in run
return self.wrapped(*args, **kwargs)

...

Docker stack. Links in docker-compose are ignored.

Hi.
I tried to use fabricio to deploy my django project to prod.
I used docker and docker-compose before on local so I created docker.Stack service with link to my docker-compose file.
But the problem is that fabricio copies docker-compose.yml to /tmp and looks for all files, linked in docker-compose.yml, in this directory. For example, my docker-compose.yml has line:

env_file:
          - docker/dev.env

And at building container, docker looks for env file in /tmp/docker/dev.env and I get error.
What is worse, dockerfiles are not found too.
I tried:

  1. Create docker.Stack with temp_dir parameter
  2. Subclass Stack and point temp_dir to my project directory (and re-define upload_configuration_file)
  3. Create symlink in tmp to my project directory.
    Without any success.
    Did I miss something important?

digital-ocean deploy

why is vagrant needed? can I deploy it without it i.e. to digital ocean?

can you please add documentation or example on how to deploy docker image from docker-hub to digital ocean?

Additional service options

There is a bunch of new removable options added to the Docker services recently:

  • config
  • dns
  • dns-option
  • placement-pref
  • group
  • host
  • secret

Delete service

Hi
How can I remove containers and services related to a task.

Use remote_tunnel only for local Docker registries

In situations when using custom registry with PullDockerTasks, remote_tunnel can take port which already used by some of containers. Therefore, PullDockerTasks should detect if remote_tunnel is really necessary.

In most cases remote_tunnel is necessary only for registries which point to the local host.

Kubernetes support

Same way as #127 (Docker stacks / Docker Compose) was resolved there is opportunity to add Kubernetes support.

Warning: local() encountered an error (return code 1)

Hi, what could the source of the problem?
Beating the head against a wall

Fabric==1.14.0
fabricio==0.3.1

local: docker build --tag front:latest --pull --build-arg nginx_config_filename=local.conf .
Sending build context to Docker daemon 436.6MB
Step 1/15 : FROM centos:centos7
Get https://registry-1.docker.io/v2/: EOF

Warning: local() encountered an error (return code 1) while executing 'docker build --tag front:latest --pull --build-arg nginx_config_filename=local.conf .'

Traceback (most recent call last):
File "/usr/local/lib/python2.7/site-packages/fabric/main.py", line 757, in main
*args, **kwargs
File "/usr/local/lib/python2.7/site-packages/fabric/tasks.py", line 426, in execute
results[''] = task.run(*args, **new_kwargs)
File "/usr/local/lib/python2.7/site-packages/fabric/tasks.py", line 173, in run
return self.wrapped(*args, **kwargs)
File "/usr/local/lib/python2.7/site-packages/fabricio/tasks.py", line 368, in deploy
fab.execute(self.prepare, tag=tag, no_cache=no_cache)
File "/usr/local/lib/python2.7/site-packages/fabric/tasks.py", line 426, in execute
results[''] = task.run(*args, **new_kwargs)
File "/usr/local/lib/python2.7/site-packages/fabric/tasks.py", line 173, in run
return self.wrapped(*args, **kwargs)
File "/Users/myusername/Develop/chat-bot/frontend/fabfile.py", line 206, in prepare
use_cache=True,
File "/usr/local/lib/python2.7/site-packages/fabricio/init.py", line 74, in local
**kwargs
File "/usr/local/lib/python2.7/site-packages/fabricio/init.py", line 27, in _command
raise RuntimeError(result)
RuntimeError

ProvisionTasks

I think it would be nice to have ProvisionTasks inheriting base Tasks and providing some basic provisioning commands. Such as:

  • init (default)
  • remove
  • update

Such class would be useful for management of Docker networks, volumes and other entities.

start multiple dockers

can I start 4 running versions of same docker image?

I see a replicas option, can It be used to spin 3 dockers

RuntimeError during attempt to delete dangling images

Any attempt to execute deploy configuration fails with following message:

RuntimeError: local() encountered an error (return code 1) while executing 'for img in $(docker images --filter "dangling=true" --quiet); do docker rmi "$img"; done'

This happens when Docker can't delete some images (due to existing containers from such images, for example).

Skip tasks without any host provided

There are two alternatives if Fabric can't determine host for task:

  1. Fabric can ask host using prompt
  2. use --abort-on-prompts option

Both cases lead to inability to complete automatic scripts based on Fabricio. It's necessary to have graceful skipping of tasks which's host can't be determined at runtime.

localhost infrastructure

Is it any way how launch containers locally?

I have tried to create

# Infrastructure
@fabricio.tasks.infrastructure
def localhost():
    fab.env.roledefs.update(
        amqp=['anton@localhost'],
        reverse_proxy=['anton@localhost'],
        postgres=['anton@localhost'],
        tarantool=['anton@localhost'],
        backend=['anton@localhost'],
    )

but got error

Fatal error: Low level socket error connecting to host localhost on port 22: Unable to connect to port 22 on 127.0.0.1 (tried 1 time)

Underlying exception:
    Unable to connect to port 22 on 127.0.0.1

'pull' не срабатывает, если не указан хост

Собираю образ, пытаюсь его запулить в локал регистри (у меня потом на базе этого образа собирается основной)
.pull не срабатывает, так как не указан хост в таске, но мне же хост и не нужен, registry то указан, я хочу просто сохранить образ, а следующий таск уже соберет основной на его базе и запулит его на бой.

'pull' execution was skipped due to no host provided (command: edcontainer.pull)

Можно ли подумать над изменением этой логики?

TypeError when trying to get detailed info about command

fab -d test
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/fabric/main.py", line 694, in main
    display_command(options.display)
  File "/Library/Python/2.7/site-packages/fabric/main.py", line 479, in display_command
    task_details = command.__details__()
  File "/Library/Python/2.7/site-packages/fabric/tasks.py", line 183, in __details__
    return get_task_details(orig)
  File "/Library/Python/2.7/site-packages/fabric/tasks.py", line 42, in get_task_details
    argspec = inspect.getargspec(task)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/inspect.py", line 816, in getargspec
    raise TypeError('{!r} is not a Python function'.format(func))
TypeError: <functools.partial object at 0x10c9a2260> is not a Python function

Upload compose-file for docker stack

I cannot upload a compose-file from a folder other than the fabfile.py folder since the "upload_configuration_file" script will try to upload it to the path of the mentioned local folder.
Example:
stack = tasks.DockerTasks(
service=docker.Stack(
name='stack',
options={
'compose-file':'/folder0/../foldern/docker-compose.yml',
},
),
hosts=fab.env.hosts,
destroy_command=True,
)

fab will try to upload the docker-compose file to "/folder0/../foldern/docker-compose.yml" and not to temp_dir folder which will cause error if the path does not exist in the distant machine

Not able to deploy locally without ssh

Version of fabricio==0.3.1

To force deploy locally I started describing the task as following

@tasks.infrastructure
def localhost():
    print("Trying to run fab locally")
    fabricio.run = functools.partial(fabricio.local, capture=True)
    fab.env.update(
        roledefs={
            'queue': ['localhost'],

...

Still it had no effect, it tries to deploy locally via ssh

'Tasks.name' property implementation

This property can be used to assign custom commands name for groups of tasks, including infrastructures. For example:

name_with_underscores = Tasks(name='name-with-hyphens')

or

@infrastructure(name='UPPER')
def lower()
    pass

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.