Wednesday, June 03, 2015

Strongloop with Codenvy Part1

Setting up a Loopback project in Codenvy


From the codenvy dashboard, create a new project. Choose type: Blank Project and provide a name and description. As an example, I named mine: my-api with description: Sample project for Strongloop and Codenvy


Wait a bit for codenvy to initialize the project and IDE. Next, reveal the Runners tab by clicking on the Runners button at the lower left part of the IDE. Then go to the Configs tab and click on Create New button.


Replace the Dockerfile content with the one below. Make sure to change CODENVY_USER, CODENVY_PASS and CODENVY_PROJECT with your own values.


FROM henyojess/codenvy-strongloop:v1.0.1

RUN export PATH=/opt/codenvy-cli-2.10.0/bin:$PATH && \
CODENVY_USER=jessie@sample.com && \
CODENVY_PASS=samplepassword && \
CODENVY_PROJECT=my-api && \
codenvy login $CODENVY_USER $CODENVY_PASS && \
CODENVY_PROJECT_ID=$(codenvy list | grep $CODENVY_PROJECT | awk '{ print $1}') && \
echo "codenvy clone-local $CODENVY_PROJECT_ID" >> /home/user/.bashrc

Click on the Save button on the right side of runner config tab. This creates a runner with oracle java 7, the codenvy-cli 2.10.0, git, node, npm and strongloop-cli. This will also login the codenvy-cli and clone the project files and folders into the home folder.


Run the runner created above and access the Terminal tab. Create a loopback project with the strongloop cli:


cd my-api
slc loopback --skip-install

Push the created files to the project file system hosted by codenvy:


codenvy push

Reload the browser to see the new files in the IDE. You may also need to restart the runner for the new files to appear in /home/user/runtime. To run the application after restarting the runner, access the terminal then do:


cd /home/user/runtime
npm install && slc run

1 comment: