The Cloud Stove currently consists of two main components: The backend API implemented using Ruby on Rails and the front end application implemented using AngularJS. This document should provide you with enough information to correctly set up the front end application, in order to extend its features.
The front end is written entirely using the framework Angular 2 and in TypeScript. If you find yourself unfamiliar with either of these two, the fastest way to get a grasp of the concepts is by following the excellent Learning Angular section of the official documentation. The Cloud Stove project is heavily inspired by the official samples provided by Google in its structure and tool usage.
The project is structured as follows:
-
Contains the documentation you are currently reading ;)
-
A basic ExpressJS server to serve the static contents of the front end, when compiled and deployed in production. You can also use any kind of webserver that is able to statically serve files to fulfill this task. The provided server is used when deploying the front end as Docker container.
-
Enables deployment on Heroku and manages its configuration.
-
Enables Unit-Testing using Karma.
-
Enables E2E using Protractor. By default, this project tests against Chrome. You can change this setting by overriding
{'browserName': 'chrome'}
in this file to your liking. -
tsconfig.json, tslint.json, typedoc.json
Configuration for various TypeScript-settings and linter settings. The
tslint
is mostly following Googles standard for Angular projects using TypeScript. -
Config file for the webpack module bundler. More information about the specific configuration can be found in the file itself. Most likely, you won't have to change it unless a new type of file should be included in the project or an update is necessary.
-
Wercker build file that specifies how this project is built using the CI infrastructre of wercker.
The project is organized in modules that help organize the application into blocks of functionality. Each folder in src/app
usually contains a .module.ts
file that specifies the module, its dependencies and its exports. Thus, functionality can be built in building blocks and be reused easily. To get a grasp what belongs into the same module, check out the FAQ from the Angular Team.
In order to deploy The Cloud Stove front end in production, you have a number of options.
Use npm run build
to generate all static assets for production. You can start the supplied express server using npm run production
.
Build the image on your machine using docker build
, and start the container afterwards with your parameters of choice. Make sure to set the environment variables API_URL
and/or PORT
(defaults to 80) to your specific needs.
See running backend with Docker.
-
Build image:
docker build -t cloud-stove-ui .
-
Start frontend on port
1234
, assuming the backend is running onlocalhost:3000
:docker run -p 1234:80 -e API_URL='http://localhost:3000' cloud-stove-ui
-
Login with an interactive shell
docker run --rm -it cloud-stove-ui /bin/bash
Make sure to set the API_URL
config variable for your app to a running backend instance, e.g.:
heroku config:set API_URL=https://api.thestove.io
You can execute tests for the front end using one of two npm
shortcuts.
npm run test
to execute unit testsnpm run e2e
to execute E2E tests
When running E2E tests, make sure that the front end AND the Cloud Stove back end is currently up and running on your local device using npm start
.