vmagamedov / pi Goto Github PK
View Code? Open in Web Editor NEWCommand-line tool for managing containerized development environments
Home Page: https://pi-env.readthedocs.io/
License: BSD 3-Clause "New" or "Revised" License
Command-line tool for managing containerized development environments
Home Page: https://pi-env.readthedocs.io/
License: BSD 3-Clause "New" or "Revised" License
- !Pipeline
name: make latte
params:
- !Option {name: with-sugar, type: bool, default: false}
run: !Chain
- power on
- warm up
- !Map
- !Chain
- grind coffee
- make espresso
- clean
- steam milk
- merge {{with-sugar|flag}}
Basically do this:
$ docker run --rm image:version sleep 3600
$ docker exec container-id cmd *args
Instead of:
$ docker run --rm image:version cmd *args
Benefits:
$ time docker exec 952fd2f07aaa true
real 0m0.082s
user 0m0.012s
sys 0m0.009s
Instead of:
$ time docker run --rm alpine:3.6 true
real 0m0.966s
user 0m0.013s
sys 0m0.008s
===> More than 10x faster
Something like tox-travis, but with containerized environments
Prototype:
- !Image
name: test-py{3.5,3.6}
from: python:{3.5,3.6}-alpine
repository: reg.local/project.{{name}}
tasks:
- run: pip3 install {{packages|join(" ")}}
packages:
- pytest==3.0.3
- flake8==3.0.4
- !Image
name: env
from: base
repository: location/env
provision-with: !Tasks
- run: python3 {{get_pip_py}}
where:
get_pip_py: !Download "https://bootstrap.pypa.io/get-pip.py"
- run: pip3 install {{packages|join(" ")}}
where:
packages:
- requests==3.2
- sqlalchemy==1.1
- run: install -d {{src}} /path/to/src
where:
src: !Bundle "package"
It will help modify files in the container for "print"-style debugging and other types of hacks
I'll start with brief description of vagga (I know @vmagamedov already knows that but somebody visiting a page might not):
Vagga does very similar thing to what pi is supposed to do: it allows to build containers and run commands inside. It keeps list of commands in yaml config, including all advanced things like mounting volumes, building containers and so on, including the possibility to add a description for the command :) (which make lacks for unknown reason)
The key difference is: pi uses docker as a containerization, but vagga doesn't, it implements containers using raw linux system calls. And that largely limits feature set of both utilities. Let me explain.
There are two major reasons for this, that are relevant to this discussion:
vagga test
in a gitlab-ci has access only to project dir (+ containers and cache), and doesn't run with elevated privileges (as a user that runs gitlab-ci-runner). While any tool around docker can docker run --privileged
. [*].vagga/containername/usr/lib/python3.5/site-packages
. So you can just point IDE there. For docker you need some hacks to achieve this.[*] To run docker securely on a shared server like gitlab-ci you need to set up a separate virtual machine for every project and use docker socket of that machine in docker run. And yes we need security in CI system because we deploy from it.
Vagga runs in docker on linux perfectly fine. So should run in docker for mac too. We just need a small script that runs docker run
with some preconfigured settings. Here is a vagga issue for the topic, that has no feedback so far. We just need to figure out:
.vagga
folder on host system and how expensive it is (to allow IDEs accessing files inside the container) [*]--volume=/work/.vagga:/vagga
/usr/lib/python3.5/site-packages
outside of the container on each build[*] Files in the project dir will definitely be accessible from a host filesystem. We only question files of the container filesystem, like system libraries, python packages...
Answers on few obvious questions:
Well, vagga is almost 2 years old (the first commit of bare readme file was at 28th June). So it already got some things. Here is what you are going to loose:
Well, I hope not. It's open source. We try to contribute and collaborate as much as possible to not to waste too much resources on duplicate efforts. Sometimes forks and rewrites are justified sometimes not. It happens that owners are just uninformed. And occasionally, projects join the effort again. Hopefully, we can make another successful case for that.
Add ability to define Image
in the Command
definition, when this image will not be reused by another command, to place them together.
Prototype:
- !Command
name: version
run: python3 --version
image: !Image
name: version
from: !DockerImage alpine:3.4
repository: reg.local/project.version
tasks:
- run: apk add --no-cache python3
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.