PaaS Deployment

Overview

You can deploy to a PaaS in Codenvy using the native tools provided by the PaaS providers (SDK and CLI). You will have to create a custom environment with a chosen SDK or CLI provided by your PaaS vendor. The resulting Dockerfile can vary depending on the complexity of the installation process and setting up environment. Below are examples of creating custom environment where you can deploy your Java apps to Google App Engine and AppFog.

Google App Engine

To deploy your application to Google App Engine (GAE) or other PaaS, you can use a custom runner environment that has the relevant SDK pre-installed.

Below is an example of a custom Dockerfile that creates an environment with the Google App Engine SDK installed, unpacks the .war file and launches a dev server:



FROM codenvy/jdk7
RUN mkdir /home/user/app /home/user/sdk
RUN wget -P /home/user/ --quiet http://repo.maven.apache.org/maven2/com/google/appengine/appengine-java-sdk/1.9.10/appengine-java-sdk-1.9.10.zip
RUN unzip /home/user/appengine-java-sdk-1.9.10.zip -d /home/user && cp -r /home/user/appengine-java-sdk-1.9.10/* /home/user/sdk && \
    rm -r /home/user/appengine-java-sdk-1.9.10.zip /home/user/appengine-java-sdk-1.9.10/
ENV CODENVY_APP_PORT_8080_HTTP 8080
EXPOSE 8080
WORKDIR /home/user/sdk/bin/
ADD $app$ /home/user/app/
RUN sudo chown -R user:user /home/user/app/WEB-INF/  
CMD ./dev_appserver.sh -a 0.0.0.0 /home/user/app

After you run this and when you are happy with the application and want to deploy it to GAE, go to Terminal tab and perform the following:

cd /home/user/sdk/bin
./appcfg.sh update /home/user/app

You will be prompted to enter your Google ID and password. It will be necessary to specify the application ID in the appengine-web.xml file.

If you have Docker installed locally on your machine, you can build an image and upload it to DockerHub. It will take a while to pull the image the first time, but later environment boot times will be much faster due to caching. If you choose to do so, your custom Dockerfile will look like:

FROM yourName/yourImage
ADD $app$ /home/user/app/
RUN sudo chown -R user:user /home/user/app/WEB-INF/

The same approach can be used for Python and PHP applications using the relevant SDK (some commands may need to be altered to match the SDK in use).

Visit the Google App Engine docs for more details and complete commands reference.

AppFog

AppFog offers a CLI client to manage apps and account. The CLI is installed as a Ruby gem, so you will need an environment with Ruby:


FROM codenvy/ruby210
RUN sudo apt-get -y install rubygems
RUN sudo gem install af
ADD $app$ /home/user/$app$
RUN sudo chown -R user:user /home/user
CMD while true;do true; done

Go to a Terminal, login to your AppFog account, and create/update your applications using AppFog CLI commands. See: AppFog CLI Commands Reference.

Similar to Google App Engine, you can build own image with AppFog CLI, upload it to Docker Index and use it as a base image in your custom Dockerfile.