https://github.com/setoelkahfi/hello-kitura
Kitura web framework
https://github.com/setoelkahfi/hello-kitura
ibm-bluemix kitura swift swift-framework
Last synced: 4 months ago
JSON representation
Kitura web framework
- Host: GitHub
- URL: https://github.com/setoelkahfi/hello-kitura
- Owner: setoelkahfi
- License: mit
- Created: 2017-12-05T04:19:34.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-12-08T10:26:26.000Z (over 7 years ago)
- Last Synced: 2025-02-24T14:58:05.259Z (4 months ago)
- Topics: ibm-bluemix, kitura, swift, swift-framework
- Language: Swift
- Size: 68.4 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## Scaffolded Swift Kitura server application
[](https://bluemix.net)
[](https://developer.ibm.com/swift/)### Table of Contents
* [Summary](#summary)
* [Requirements](#requirements)
* [Project contents](#project-contents)
* [Configuration](#configuration)
* [Run](#run)
* [Deploy to Bluemix](#deploy-to-bluemix)
* [License](#license)
* [Generator](#generator)### Summary
This scaffolded application provides a starting point for creating Swift applications running on [Kitura](https://developer.ibm.com/swift/kitura/).### Requirements
* [Swift 3](https://swift.org/download/)### Project contents
This application has been generated with the following capabilities and services:* [CloudConfiguration](#configuration)
* [Embedded metrics dashboard](#embedded-metrics-dashboard)
* [Docker files](#docker-files)
* [Bluemix cloud deployment](#bluemix-cloud-deployment)#### Embedded metrics dashboard
This application uses the [SwiftMetrics package](https://github.com/RuntimeTools/SwiftMetrics) to gather application and system metrics.These metrics can be viewed in an embedded dashboard on `/swiftmetrics-dash`. The dashboard displays various system and application metrics, including CPU, memory usage, HTTP response metrics and more.
#### Docker files
The application includes the following files for Docker support:
* `.dockerignore`
* `Dockerfile`
* `Dockerfile-tools`The `.dockerignore` file contains the files/directories that should not be included in the built docker image. By default this file contains the `Dockerfile` and `Dockerfile-tools`. It can be modified as required.
The `Dockerfile` defines the specification of the default docker image for running the application. This image can be used to run the application.
The `Dockerfile-tools` is a docker specification file similar to the `Dockerfile`, except it includes the tools required for compiling the application. This image can be used to compile the application.
Details on how to build the docker images, compile and run the application within the docker image can be found in the [Run section](#run) below.
#### Bluemix cloud deployment
Your application has a set of Bluemix cloud deployment configuration files defined to support deploying your application to Bluemix:
* `manifest.yml`
* `.bluemix/toolchain.yml`
* `.bluemix/pipeline.yml`The [`manifest.yml`](https://console.ng.bluemix.net/docs/manageapps/depapps.html#appmanifest) defines options which are passed to the Cloud Foundry `cf push` command during application deployment.
[IBM Bluemix DevOps](https://console.ng.bluemix.net/docs/services/ContinuousDelivery/index.html) service provides toolchains as a set of tool integrations that support development, deployment, and operations tasks inside Bluemix. The ["Create Toolchain"](#deploy-to-bluemix) button creates a DevOps toolchain and acts as a single-click deploy to Bluemix including provisioning all required services.
### Configuration
Your application configuration information is stored in the `config.json` in the project root directory. This file is in the `.gitignore` to prevent sensitive information from being stored in git.The connection information for any configured services, such as username, password and hostname, is stored in this file.
The application uses the [CloudConfiguration package](https://github.com/IBM-Swift/CloudConfiguration) to read the connection and configuration information from the environment and this file.
If the application is running locally, it can connect to Bluemix services using unbound credentials read from this file. If you need to create unbound credentials you can do so from the Bluemix web console ([example](https://console.ng.bluemix.net/docs/services/Cloudant/tutorials/create_service.html#creating-a-service-instance)), or using the CloudFoundry CLI [`cf create-service-key` command](http://cli.cloudfoundry.org/en-US/cf/create-service-key.html).
When you push your application to Bluemix, these values are no longer used, instead Bluemix automatically connects to bound services using environment variables.
### Run
To build and run the application:
1. `swift build`
1. `.build/debug/HelloKitura`**NOTE**: On macOS you will need to add options to the `swift build` command: `swift build -Xlinker -lc++`
#### Docker
To build the two docker images, run the following commands from the root directory of the project:
* `docker build -t myapp-run .`
* `docker build -t myapp-build -f Dockerfile-tools .`
You may customize the names of these images by specifying a different value after the `-t` option.To compile the application using the tools docker image, run:
* `docker run -v $PWD:/root/project -w /root/project myapp-build /swift-utils/tools-utils.sh build release`To run the application:
* `docker run -it -p 8080:8080 -v $PWD:/root/project -w /root/project myapp-run sh -c .build-ubuntu/release/HelloKitura`### Deploy to Bluemix
You can deploy your application to Bluemix using:
* the [CloudFoundry CLI](#cloudfoundry-cli)
* a [Bluemix toolchain](#bluemix-toolchain)#### CloudFoundry CLI
You can deploy the application to Bluemix using the CloudFoundry command-line:
1. Install the Cloud Foundry command-line (https://docs.cloudfoundry.org/cf-cli/install-go-cli.html)
1. Ensure all configured services have been provisioned
1. Run `cf push` from the project root directoryThe Cloud Foundry CLI will not provision the configured services for you, so you will need to do this manually using the Bluemix web console ([example](https://console.ng.bluemix.net/docs/services/Cloudant/tutorials/create_service.html#creating-a-service-instance)) or the CloudFoundry CLI (`cf create-service` command)[http://cli.cloudfoundry.org/en-US/cf/create-service.html]. The service names and types will need to match your [configuration](#configuration).
#### Bluemix toolchain
You can also set up a default Bluemix Toolchain to handle deploying your application to Bluemix. This is achieved by publishing your application to a publicly accessible github repository and using the "Create Toolchain" button below. In this case configured services will be automatically provisioned, once, during toolchain creation.[](https://console.ng.bluemix.net/devops/setup/deploy/)
### License
All generated content is available for use and modification under the permissive MIT License (see `LICENSE` file), with the exception of SwaggerUI which is licensed under an Apache-2.0 license (see `NOTICES.txt` file).### Generator
This project was generated with [generator-swiftserver](https://github.com/IBM-Swift/generator-swiftserver) v4.1.0.