gratipay / grtp.co

Gratipay Widgets + API
https://grtp.co/
MIT License
26 stars 19 forks source link

Codenvy setup for testing grtp.co #89

Closed techtonik closed 6 years ago

techtonik commented 9 years ago

Over the weekend I discovered Codenvy for testing grtp.co changes, and I found it awesome. Saving WIP here, as I am not sure if this is a valid Docker file yet.

# Base image from Codeny that can be pulled from Docker
# Hub. The shellinabox image provides core Linux utilities
# and terminal access to runner.
# http://github.com/codenvy/dockerfiles
FROM codenvy/shellinabox

# -- Port mapping config for container and Codenvy ---

# http://docs.codenvy.com/user/creating-custom-builder-runner-environments/#port-mapping

# Make port 80 accessible from outside
EXPOSe 80

# Show Codenvy IDE port to check to detect that web
# application is running and provide a link to it.
ENV CODENVY_APP_PORT_80_HTTP 80

# Port used by Codenvy IDE clients to connect to the
# debugger of your application within the Runner.
# Codenvy maps this port to the debugger console in
# the browser. You can set this value multiple times.
# For example:
# ENV CODENVY_APP_PORT_8000_DEBUG 8000
#
# ENV CODENVY_APP_PORT_<port>_DEBUG <port>

# Set this value to the port of any terminals operating
# within your runner.  If you inherit a base image from
# codenvy/shellinabox (or any of our images that inherit
# from it, you do not need to set this value.  We already 
# set it for you.
# ENV CODENVY_WEB_SHELL_PORT <port>
#
# The following is done by codenvy/shellbox base image
#EXPOSE 4200
#ENV CODENVY_WEB_SHELL_PORT 4200

# Execute your custom commands here.  You can add
# as many RUN commands as you want.  Combining
# RUN commands into a single entry will cause your 
# environment to load faster.  Also, building your image
# with docker offline and uploading it to Docker Hub
# as a pre-built base image will also cause it to load
# Faster.
#
# Adopted from https://github.com/codenvy/dockerfiles/blob/master/base/angular-yeoman/Dockerfile
RUN sudo apt-get update && \
    sudo apt-get install -y nginx npm && \
    sudo npm install -g grunt-cli

# Mount app as /app
VOLUME ["/app"]
ENV CODENVY_APP_BIND_DIR /app
# Build stuff
RUN cd /app && pwd && ls -la # make test

# Configure nginx to serve /app/www - change root and enable directory listing
# http://stackoverflow.com/questions/5955548/how-do-i-use-sed-to-change-my-configuration-files-with-flexible-keys-and-values
RUN sudo sed -i -e 's#root /var/www/html;#root /app/www;\n\tautoindex on;#' /etc/nginx/sites-enabled/default

# Include this as the CMD instruction in your Dockerfile if
# you'd like the runner to stay alive after your commands
# have finished executing. Keeping the runner alive is
# necessary if you'd like to terminal into the image.  If 
# your Dockerfile launches a server or daemon, like Tomcat,
# you do not need to set this value as Docker will not
# terminate until that process has finished.
#CMD sleep 365d
CMD cd /app && make test && sudo nginx -g 'daemon off;'
bmicklea commented 9 years ago

Thanks very much (I work for Codenvy) - we're very glad that you're finding our solution helpful. We're actually just finishing up work on a feature that will make it much easier for project owners and committers to review pull requests from contributors, and easier for those contributors to get started with their pull requests. We'd love to demo it to you - if you're interested please email me at bmicklea@codenvy.com.

techtonik commented 9 years ago

Hi Brad. So far I am the only one who just started evaluating Codenvy, because I didn't have Linux environment at hand. I am pretty sure that everyone else have their layout and development tools ready in convenient setup at any time, so it may not be that valuable.

@bmicklea-ce, the idea about validating proposed changesets with tests is floating around since 1991 - http://en.wikipedia.org/wiki/Aegis_%28management_software%29 but at that time there was no way to securely run third-party code in isolated container. I thought about NaCl + QEMU, but it was not ready then.

For https://codereview.appspot.com/ and AppEngine apps there was idea to automatically launch demo site on request, but doing all this stuff in a free time is less and less real with every new year. So, yes, I am interested interested in technology, but not in anything patented. And Gratipay is also an open company, so the review system must be public and so far GitHub serves well for us.

@whit537 what IRC thinks about being able to Edit on GitHub and Play on Codenvy workflow?

chadwhitacre commented 9 years ago

@techtonik Would it be a workflow everyone would have to adopt, or could it live side-by-side with existing workflows?

techtonik commented 9 years ago

@whit537 I don't know.

@bmicklea-ce will it require everybody to switch to Codeny workflow, or will it be optional?