News for hackers. Stuff that matters.
Re:HTTPS-Portal: Automated HTTPS server powered by Nginx, Le... by nothrabannosir on Friday September 14, 2018 @03:11AM (#17985266)
Example : this company had part of their site built by some abstruse static site generator with a million dependencies written in a language that no one at the company had installed by default, nor knew (I think it was Ruby). We put it all in Docker, and the README changed from 10 lines of install x, y, z version foo to /random, to just “run docker build, then docker run.” Most of the people working on those docs didn’t need to know about ruby or gems or lock files or any of that.

A year later I overheard someone say thank god that thing was dockerized because I was absolutely not looking forward to installing all those dependencies just for a typo fix.

That’s one of the areas where docker shines: app delivery.

Re:HTTPS-Portal: Automated HTTPS server powered by Nginx, Le... by Fredej on Friday September 14, 2018 @03:40AM (#17985418)
I'm also still not on the docker-wagon and would like to know what I'm missing out on. Most of my stuff is python. Why is docker better than virtualenv with a requirements.txt file?

From this description it seems to solve the same issue.

I could imagine something like environment variables, but on the other hand that's something I've learned not to keep in version control, and putting it in docker would be exactly that, no?

Re:HTTPS-Portal: Automated HTTPS server powered by Nginx, Le... by anyzen on Friday September 14, 2018 @04:12AM (#17985541)
> Why is docker better than virtualenv with a requirements.txt file?

It's not, it solves a different issue. If you only have Python as dependency, requirements.txt are fine (well, user needs to install correct version of Python, pip and virtualenv / pipenv, but that's doable). But as soon as your app is actually composed of nginx / apache, python, some background process in Rust, bash scripts for cron jobs,... then you have a problem with app delivery, which Docker solves nicely. Just package eveything in a Dockerfile and distribute the image. Bonus point: you can now test it locally, with the same installation.

I jumped on Docker wagon very early for this exact reason. I don't care about hype, but it does solve these kinds of problems.

Re:HTTPS-Portal: Automated HTTPS server powered by Nginx, Le... by Ralfp on Friday September 14, 2018 @06:22AM (#17986070)
I'm also python dev and I'm embracing docker for delivering my app to users.

> Why is docker better than virtualenv with a requirements.txt file

One of issues that `docker-compose build` solves better is that venv is superconfusing to your non-python users. I've had people:

- skip it and do `python setup.py install` instead - skip it and install requirements globally `pip install -r requirements.txt` because thats how it worked for them last time they used python - version control their `venv` directory - backup and upload their `venv` directory on new server when moving

Now they just do `./appctl setup` that asks them for few things, writes `setup.env` file for docker-compose, and then runs `docker-compose build`

But this is only beginning. Thanks to `docker-compose` that `build` step also installs:

- PostgreSQL database - Redis for caching and message queue - UWSGI - Celery - Nginx proxy

Re:HTTPS-Portal: Automated HTTPS server powered by Nginx, Le... by SteveLTN on Friday September 14, 2018 @04:25AM (#17985590)
> Why is docker better than virtualenv with a requirements.txt file?

You can't put postgres, memcached, imagemagick in requirement.txt, can you?

Re:HTTPS-Portal: Automated HTTPS server powered by Nginx, Le... by nickjj on Friday September 14, 2018 @07:09AM (#17986279)
You might want to read this blog post as it walks through setting up a dev environment for Python with and without Docker:

https://nickjanetakis.com/blog/setting-up-a-python-developme...

The TL;DR is a typical web app is often a lot more than just running Python, and there's a huge amount of value in being able to run the same code across different operating systems without any installation changes.

Re:HTTPS-Portal: Automated HTTPS server powered by Nginx, Le... by cvakiitho on Friday September 14, 2018 @03:43AM (#17985425)
not every dependency is written in python.
Re:HTTPS-Portal: Automated HTTPS server powered by Nginx, Le... by bpizzi on Friday September 14, 2018 @03:31AM (#17985368)
Or to say it differently: "that's one of the areas where interpreted languages' ecosystems stinks: app delivery".
Re:HTTPS-Portal: Automated HTTPS server powered by Nginx, Le... by dbdjfjrjvebd on Friday September 14, 2018 @03:57AM (#17985491)
The OP says app delivery but they actually talk about development builds. Dev builds are another area where Docker/containerisation helps. Dev builds are just as annoying with Golang as Ruby or Python. In fact build awkwardness is orthogonal to static vs dynamic typing.
Re:HTTPS-Portal: Automated HTTPS server powered by Nginx, Le... by bpizzi on Friday September 14, 2018 @04:45AM (#17985674)
> Dev builds are just as annoying with Golang as Ruby or Python.

Hm, I'm pretty sure I can take any Go project out there and build it in a matter of minutes on my current OS (depending on the build time of course). Just a matter of setting the environment on the right compiler binary and retrieving dependencies (which just came better 2 weeks ago with 1.11's modules).

I'm pretty sure too I'll very quickly run into dependencies hell by picking randoms ruby/python programs. Just take a look at that SO question: https://stackoverflow.com/questions/2812471/is-there-a-pytho....

Interpreted languages have their uses, of course, but there's a clear difference in both ease of deployment and development between the realms of interpreted languages (Ruby/Python/PHP/etc.), VM/IL/JIT based languages (JVM/.NET/etc.) and 'plain old' compiler based languages (C/C++/Rust/Go/etc.).

> In fact build awkwardness is orthogonal to static vs dynamic typing.

I said "interpreted languages' ecosystems", not "dynamically typed languages". I think you're mixing concepts here (or just maybe you're adding info not directly related to my comment).

Re:HTTPS-Portal: Automated HTTPS server powered by Nginx, Le... by icebraining on Friday September 14, 2018 @05:14AM (#17985793)
Just a matter of setting the environment on the right compiler binary and retrieving dependencies

Which is exactly how it works in Python.

I'm pretty sure too I'll very quickly run into dependencies hell by picking randoms ruby/python programs. Just take a look at that SO question:

That SO question is about a tool for "setting the environment on the right compiler binary and retrieving dependencies". But you can also do it manually just fine; that's how I usually did it, in fact. Just retrieve the dependencies to a directory and call Python with PYTHONPATH set to it.

Pyenv is essentially the same as Go's new modules tool, it's just not called through the same binary as the interpreter/compiler.

Interpreted languages have their uses, of course, but there's a clear difference in both ease of deployment and development between the realms of interpreted languages (Ruby/Python/PHP/etc.), VM/IL/JIT based languages (JVM/.NET/etc.) and 'plain old' compiler based languages (C/C++/Rust/Go/etc.).

Yes; with Python, you can both run directly from source without wasting time compiling after each change, or you can produce a standalone binary (dependent only on libc) for distribution, using a tool like PyInstaller. Plain old compiled based languages are much more limited.

Re:HTTPS-Portal: Automated HTTPS server powered by Nginx, Le... by bpizzi on Friday September 14, 2018 @05:58AM (#17985985)
> Yes; with Python, you can both run directly from source without wasting time compiling after each change

As I said, interpreted languages have their uses, of course. My initial point was about delivery to end users.

Re:HTTPS-Portal: Automated HTTPS server powered by Nginx, Le... by icebraining on Friday September 14, 2018 @07:12AM (#17986295)
And my point, which you cutoff early, is that with Python you can have both.
Re:HTTPS-Portal: Automated HTTPS server powered by Nginx, Le... by bpizzi on Friday September 14, 2018 @08:27AM (#17986682)
Yes, you can have everything in every language. After all it's turtles all the way down.

What makes us successful as software engineers, in the end (and IMHO), is the efficiency level at which we reach our goals. To my eyes, when deliverability is the goal, then a language where native (cross)compilation is first class citizen is the most efficient path. But don't get me wrong, Python is really great and still a good choice for that scenario (I'm thinking of dropbox, for ex).

Re:HTTPS-Portal: Automated HTTPS server powered by Nginx, Le... by ric2b on Friday September 14, 2018 @12:19PM (#17988490)
But setting up a build system is a tiny part of time it takes to finish a project, so why would it be a major factor when choosing a language?
Re:HTTPS-Portal: Automated HTTPS server powered by Nginx, Le... by bpizzi on Saturday September 15, 2018 @03:29AM (#17993399)
Mainly because I currently work on long term projects, building entreprise grading systems. Here you want simple, dumb technologies for which you'll still be able to put up build OS in the years to go.
Re:HTTPS-Portal: Automated HTTPS server powered by Nginx, Le... by dbdjfjrjvebd on Friday September 14, 2018 @04:54AM (#17985702)
I can build any python project in 10 mimutes (and not pollute my global environment). I can't do that with Go or C or C++ or Ruby or php. I can if they are dockerised.
Re:HTTPS-Portal: Automated HTTPS server powered by Nginx, Le... by bpizzi on Friday September 14, 2018 @05:03AM (#17985751)
Sorry I can't follow you (no offense really).

You said at first "Dev builds are just as annoying with Golang as Ruby or Python" and now you're saying "I can build any python [...] I can't do that with [...] Ruby"?

Re:HTTPS-Portal: Automated HTTPS server powered by Nginx, Le... by dbdjfjrjvebd on Friday September 14, 2018 @05:16AM (#17985806)
I mean that I am knowledgable about Python builds. You are knowledgable about Golang. Neither skill is special. With Docker I don't need to learn as much about FooLang's build process to contribute to a project using FooLang.
Re:HTTPS-Portal: Automated HTTPS server powered by Nginx, Le... by bpizzi on Friday September 14, 2018 @05:44AM (#17985920)
Thanks, it gets clearer. As a matter of fact I'm both knowledgeable in building things in Python and Go, Node and PHP too. And others. But, admittedly, for 'big' things I tend to lean on Go nowadays (edit: mainly because I need to deliver on-premise, OS-aware applications).

It seems like you think there's a "build process" with Go because you're accustomed to python/pyenv (or whatever is your env manager of choice), in which cas you need to known that there's no such thing with Go.

The two following course of actions are the same: - "apt-get docker; docker pull {project-url}; docker start {project-url}" - "apt-get golang; git pull {project-url}; go run .go" (the last Go 1.11 will take care of dependencies at build time)

You can't as easily do "apt-get python; git pull {url}; python .py", unless the program is really simple, because there's such questions as "python2 or 3?" or "pyenv, virtualenv or anaconda?", obligatory XKCD here: https://xkcd.com/1987.

But it's totally ok not to bother learning the compilation command of a given project's language and rely on Docker, really I'm ok with that, doing it myself from time to time. My initial point was on app delivery to final users.

Re:HTTPS-Portal: Automated HTTPS server powered by Nginx, Le... by ric2b on Friday September 14, 2018 @12:27PM (#17988551)
You're right that the multiple solutions for Python make things confusing and prevent you from using the same method for every project, hopefully we'll start to standardize on pipenv, which makes the process:

"apt install python3 python3-pipenv; git pull {url}; pipenv sync; python3 .py"

pipenv sync sets up a virtual env and pulls all the dependencies.

Re:HTTPS-Portal: Automated HTTPS server powered by Nginx, Le... by simongr3dal on Friday September 14, 2018 @03:25AM (#17985333)
I get that docker makes this simpler but it’s not really a feat only docker could accomplish, a makefile or bash script could have accomplished the same thing.
Re:HTTPS-Portal: Automated HTTPS server powered by Nginx, Le... by jarfil on Friday September 14, 2018 @03:37AM (#17985402)
A bash script would have to automatically install all the dependencies. Over time, there is a growing chance that some of the versions required will conflict with whatever is already installed on the machine, and someone will have to go in and fix them... then fix them in a way that it works on everybody's machines.

With docker, you can just ignore all that. As long as there is a single person capable of updating the dependencies on a single machine with docker, it'll work the same everywhere, always.

Re:HTTPS-Portal: Automated HTTPS server powered by Nginx, Le... by louiskottmann on Friday September 14, 2018 @03:31AM (#17985372)
A bash script would be nowhere near as practical. First of all it would be much more complicated to deal with various environments, and in practice, docker run/docker stop is much easier to upgrade.
Re:HTTPS-Portal: Automated HTTPS server powered by Nginx, Le... by v_lisivka on Friday September 14, 2018 @06:20AM (#17986066)
If everybody in your team uses same distribution of Linux (say latest Fedora, for example), then all dependencies can be packaged into RPM or installed from system repository. RPM and docker are very similar in general idea: they are both image of result of installation of a program(RPM)/system(Docker).

Every member of team will need to run same version of Fedora directly or in Vagrant or in (ta-da) docker container.

From my experience, it turned out that for small Dockerfile's, RPM packages are unnecessary burden, so usually I just start with just docker. But later, when Dockerfile growths, it much harder to track dependencies and installation instructions, when they are interleaved, so it much easier to return to individually packaged programs and replace almost whole content of Dockerfile with single "dnf install meta-package" command.

Re:HTTPS-Portal: Automated HTTPS server powered by Nginx, Le... by johnchristopher on Friday September 14, 2018 @03:28AM (#17985356)
You could also move bits with a magnet over the circuits but it's more error prone /s.