Giter VIP home page Giter VIP logo

docker-project-manager's People

Contributors

ledestin avatar

Watchers

 avatar  avatar  avatar

Forkers

ledestin

docker-project-manager's Issues

SSH public key is not in the right format

Generated key:

-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0atg7Mea0QZSvjSjwgfY
wyql+UfK3RdvoGRqI6ihj6SoF92njEvVfTxMUGASFU229Zt5CpSiXCqEy6ZOYQkK
MZV7SsoInToEgLGp3X05tddFmWr4A5IAP/TQWmVogc9RfWdYvZtIIQCP254nuOee
vLTzvmeq+kcGxAXqGrKbaWX6vfdA0MOViL9naxUY7ezn5FZh6uF3HMiFWf4WiRq6
TJZEgVE2aWVJ5Y5Ptx/MP1KWf0YFpHfvTNPhTiRx4yhUOrxVNiGw17Qs9mC6YbRk
kG7ZbFa/aK/yOhTfdDlKfxkNKuCN7u+yLycUSftraygt3Ibi3yYy8H8WeRIWfXTq
eQIDAQAB
-----END PUBLIC KEY-----

An example of a valid public key:

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC3PftpccsW8mBhLxdd+I70XzVJ1saoyzzrgOR/EkV9fS+RH12x/vNUW3i5aBVxRUipnZwGd3uhFlnlaNDvQAkfQN0ea81C9BVrb6WodvDHcGjfVPMF7UOgeVInpa+w+vpdWVqi8SJjun0fv7GV2NzY8WVzD0UegtG0yvKVOY3kmvKnUlrsrtSXgZunONeWFxG68B9wS1tUqslcc8Nfz1fca+0o5TMAwf7oHVQ4gz/KSRRW0bMtXeF3N2cuYeV+r6vwc5gCV9UqaE+PzbxKRlr5AqHPuh2JxlhObM/aggUnfXNdpQ5BXQSHIh0It9i0tvP4NsDrZ7+kYSvB8LdX3DYZKFdUmxojys5JWy6i5AzFP1vG0YyVTD7Vk6sDRFKFO1bUM5puLM7DvLndxkLz72kv8UcSzGtqRHdYQM2ZHO2b/Pm7anf+4TeEC5usDdLnaOT4I3uAAhLaQfMb+XweM1NyLaMRzepoGGoS+yj1ZHdGG1TipxXk8xI+Q/AXMOYHZjyzmUtDffOEU/KCI++NKCqmmNJKlkkD3SpLjv3+tDYeYHP9E6SiSTKhEQ45k1+fxxsCSZ+EU7ow+3sY9fSiciKRaXbfmoe/q00ZHQapY9ePbVIDQUJOKxmD0mNINPXD+4WnCpVFcQACQ+46Ah8A2FsFRcVlr09hq0mLf1U3rYVtPQ== botanicus@ipad

According to StackExchange, it can be converted thus:

ssh-keygen -f private.pem -y > private.pub

The code: src/ssh-key-pair.cr

Sync from/to Dropbox

Get existing projects from Dropbox

Useful when a new VM is created:

This will take download everything from Projects/vps in Dropbox and saves it as projects.

dpm dropbox-download Projects/vps projects

Update Dropbox with existing project files on the VPS

dpm dropbox-upload projects Projects/vps

This will take everything in projects/ and upload it to Projects/vps, (replacing what's already there?).

There is no Crystal Dropbox library.

Dropbox API

Consider directory-based approach

The manager could have access to $HOME and each component would have it's own $HOME-like directory:

riffr/README.md
riffr/Dockerfile (effectively contains the recipe of the project)
riffr/docker-compose.yml (optional)
riffr/.ssh/id_rsa
riffr/.ssh/id_rsa.pub
riffr/.history
riffr/.dotfiles.git
riffr/riffr (the actual repo)

Insulating .dotfiles.git allows us to use ~/.zsh/ignored.zsh that we don't want to share across projects.

These Dockerfile's are private, never to be pushed to DockerHub. For instance:

FROM botanicus/dev:latest
ENV DROPBOX_ACCESS_TOKEN=xyz
EXPOSE 3000
VOLUME

Since EXPOSE doesn't publish anything by itself, the manager should parse the Dockerfile, take the exposed ports and convert them to "<port>:<port>" form for the docker create command.

The same goes for VOLUME. One cannot specify host directory in Dockerfile. So the manager should scan the Dockerfile and convert all VOLUME entries into "<project-name>/<volume>:<volume>".

Considerations: Maybe I could just use this pseudo-home directory as the only volume? -v ~/riffr:/root?

Recreate DPM env using DPM

After that, recreate the env for DPM and add pre-commit hook to run crystal tool format in it.

First though we have to implement #21

Add the sh command

To create a tmux session or attach to the running one.

Maybe it can be named sys as there's no sys sys really.

Create Rakefile-like script in the project root directory

Apart from Dockerfile and README.md, we need a script that makes it easier to manager containers.

This should be the primary interface to DPM after a project is initialized.

cd ~/projects/docker-project-manager
rake create
rake attach
rake rebuild

Top-level manager

Rather than installing .bashrc with helpers (#5), let's support creating a top-level manager instance that has access to the whole $HOME.

Since the manager doesn't store any running state, it should always be run as a one-off command with run --rm.

docker-project-manager run riffr
# docker run -it --rm -v $HOME:/root/host botanicus/dev zsh -c 'tmux ...
docker-project-manager create <my-project> # ...

Bonus: docker-project-manager write-alias to add alias dpm="docker run -it --rm botanicus/docker-project-manager" into .bashrc.

Support overriding SSH key

Default: mount ~/.ssh as a volume.
Override: generate a new SSH key and pass it as an ENV variable.

This way we don't have to do IdentityFile ~/.ssh/jcrussell_gitlab_com etc if one has multiple GitLab accounts.

The disadvantage may be, that the key gets recreated every time we recreate image with docker rm.

We could create a new SSH dir and mount that one to /root/.ssh, but I'm not fond of such approach.

Also we could just pass all the SSH keys as ENV variables, I think it's reasonable, the only thing is we'd have to mount ~/.ssh for the docker-project-manager to run.

Alternatively we can use simple Dockerfiles as:

FROM botanicus/dev:latest
RUN ssh-keygen -t rsa

Then the SSH key would be cached (or not?)

Fix unit tests on Travis CI

Locally unit tests run (through docker build) just fine.

On Travis it fails though.

I temporarily commented out that line.

  • Uncomment crystal spec in Dockerfile.
  • Make sure it passes on Travis.

Add a background of why it was created

I'm a freelancer. Many projects I do are short-term. Hence I need to spin off VM-like machines quickly with all my dotfiles and tools of choice installed.

Support DinD

The top-level manager #6 can work in 2 ways:

Either it prints it commands that are then piped to the host OS shell (that all is probably wrapped into a helper). This is OK to start, but at the end of the day, it'd be great if the manager could execute the commands directly.

The issue is that it's hard to install docker in BusyBox. BusyBox doesn't have a package manager. I can imagine a lot of tools would be missing for compilation. I wonder whether it's possible to build a statically-linked docker binary and copy it just as we copy the binary we build from the Crystal source.

Probably the easiest solution is to derive the final image from https://hub.docker.com/_/docker

Add rebuild command

Which will be a shortcut for: stop, remove, build, create and start.

Well, as of now without start, since create doesn't really create anything just yet: create a follow-up ticket.

Minimal ZSH configuration

This probably will just be a section in README, but it'd be handy to be able to copy & paste from somewhere:

  1. apt install -y zsh
  2. echo $(which zsh) && chsh -s $(which zsh)
  3. wget https://raw.githubusercontent.com/botanicus/dotfiles/master/.zsh/host.zsh -O ~/.zshrc

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.