dcposch / scramble

Secure email for everyone
http://dcposch.github.io/scramble/
226 stars 32 forks source link

Tooling Ideas #60

Open TobiasBales opened 10 years ago

TobiasBales commented 10 years ago

Looking good - I got a couple of ideas to make everyone's work easier.

If there is interested in either or both options I would gladly build both.

dcposch commented 10 years ago

Hi Tobias,

Thanks! Those both sound like excellent ideas. And sorry for the delayed reply, don't know why I missed this.

Editorconfig

This would be a nice improvement, especially for Javascript. For Go, Jae and I are using a pre-commit hook that runs gofmt first, which normalizes everything.

Docker

I spent some time reading about Docker. Looks very clean. You're proposing making a Docker image of the dev environment. Should we use Docker to deploy the site in production (scramble.io) and staging (gpgmail.io) as well?

TobiasBales commented 10 years ago

Yeah running gofmt makes sense. No problem just using it for js only or having it force tabls at least for go.

Regarding docker I am really happy using it but I would suggest I build the images/dockerfiles and you can try it as a dev environment and see how happy you are.

If you really like it you can start using it on staging and if you then like it get it further to production. There are quite a few companies using docker in production now but I think it is always good to know what you are doing ;)

Ultimately it makes for very clean deployments but just take it one step at a time.

I will see if I can finish the setup tonight or tomorrow.

dcposch commented 10 years ago

Ultimately it makes for very clean deployments but just take it one step at a time.

Yeah, I didn't mean immediately :)

Also read on Docker's website that it's not yet recommended for production use. The Docker Github repo has an amazing amount of activity---looks like a lot of people really care. It's still very new.

I look forward to using it as a dev environment and trying it out on gpgmail.io . Thanks again!

dcposch commented 10 years ago

Any luck? @TobiasRaeder

Otherwise I'm happy to give this a try this weekend.

TobiasBales commented 10 years ago

Had some issues with my docker setup. I got a dockerfile that should work 99% but I can't get docker to do what I want after playing around with lxc (i.e. compiling from source and aparently breaking something). If I can't get it fixed by tomorrow or so I will just push it maybe one of you guys can work out the last issues.

Sorry for the huge delay.

jbenet commented 10 years ago

Also read on Docker's website that it's not yet recommended for production use. The Docker Github repo has an amazing amount of activity---looks like a lot of people really care. It's still very new.

@dcposch the docker ecosystem is massive. Several startups are betting hardcore on it (dotcloud, coreos, etc). And do use in production. I do too. I really recommend it.

Also, docker really changes the paradigm here. "Running your own scramble server" can be as easy as "docker run dcposch/scramble". (Well, almost. + notary/config. but way less setup.)

@TobiasRaeder what's the problem? maybe I can help. What does your Dockerfile look like atm? (just paste it here)

Taking a quick look at the scramble quickstart, your Dockerfile should:

jbenet commented 10 years ago

Here's a start (not tested):

# scramble.io Dockerfile
FROM ubuntu 
MAINTAINER jbenet juan@benet.ai

# upgrade apt
RUN apt-get install -y python-software-properties
RUN add-apt-repository -y "http://archive.ubuntu.com/ubuntu universe"

# install core tools
RUN apt-get install -y markdown make gcc git mysql-server

# install go (download for platform)
RUN wget https://code.google.com/p/go/downloads/detail?name=go1.1.2.linux-amd64.tar.gz
RUN tar -xzf go1.1.2.linux-amd64.tar.gz
RUN mv go /usr/local/go

# setup go
RUN mkdir -p ~/go/src
RUN echo "export GOPATH=$HOME/go" >> ~/.bashrc
RUN echo "export PATH=$PATH:/usr/local/go/bin" >> ~/.bashrc
RUN source ~/.bashrc

# clone scramble repo
RUN mkdir /scramble
RUN git clone https://github.com/dcposch/scramble.git /scramble

# scramble dev setup
RUN echo "127.0.0.1 local.scramble.io" >> /etc/hosts
RUN cd /scramble
RUN make
# Setup the notary here. Perhaps wget a textfile from github. 
# Or, check it in to a file in the repo. Maybe default config, even.
# Or, clone a gist. I use a gist for some config files.

# chown to daemon for updating
RUN chown -R daemon /scramble

# expose port
EXPOSE :80

USER daemon
WORKDIR /scramble
CMD make

Notes:

TobiasBales commented 10 years ago

One thing I would not do is clone the repo but instead link it to the container when running using -v that way one can use an editor and other toolchain if wanted outside the container and there is no need to install vim with all config files etc in the container.

jbenet commented 10 years ago

@TobiasRaeder

Updating:

docker attach <container> 
^C
git pull
make

Update manually by attaching + pulling (+ any other verification you might do).

Don't need to edit within the container.

Sure, i'd bind-mount (-v=.:/scramble) for development, but i would not recommend this for testing/staging/production. Want to isolate the code too (and verify it at a certain point. docker image uploaded to repo could even have a trusted build :) ).

TobiasBales commented 10 years ago

Okay, makes complete sense. Btw I think you don't need to source the bashrc since each command is run with a fresh intance of the container. ie environment variables reset and bashrc is only loaded when starting bash manually.

Maybe just set the needed GOPATH, GOROOT etc via dockerfile ENV? Since they are the same for every container that would be a more useful way than bashrc imo

jbenet commented 10 years ago

Yeah, totally right! bashrc is clunky in the container. Had forgetten about ENV.