This scaffolded application provides a starting point for creating Swift applications running on Kitura.
This application has been generated with the following capabilities and services, which are described in full in their respective sections below:
To build and run the application:
swift build
.build/debug/[PROJ_NAME_PLACEHOLDER]
A description of the files related to Docker can be found in the Docker files setion. 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:/swift-project -w /swift-project myapp-build /swift-utils/tools-utils.sh build release
To run the application:
docker run -it -p 8080:8080 -v $PWD:/swift-project -w /swift-project myapp-run sh -c .build-ubuntu/release/[PROJ_NAME_PLACEHOLDER]
To deploy your application to your Kubernetes cluster, run helm install --name myapp .
in the /chart/[PROJ_NAME_PLACEHOLDER]
directory. You need to make sure you change the repository
variable in your chart/[PROJ_NAME_PLACEHOLDER]/values.yaml
file points to the docker image containing your runnable application.
The iterative-dev.sh
script is included in the root of the generated Swift project and allows for fast & easy iterations for the developer. Instead of stopping the running Kitura server to see new code changes, while the script is running, it will automatically detect changes in the project's .swift files and recompile the app accordingly.
To use iterative development:
- For native OS, execute the
./iterative-dev.sh
script from the root of the project. - With docker, shell into the tools container mentioned above, and run the
./swift-project/iterative-dev.sh
script. File system changes are detected using a low-tech infinitely looping poll mechanism, which works in both local OS/filesystem and across host OS->Docker container volume scenarios.
This application uses the SwiftMetrics package 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.
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.
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).
This project was generated with generator-swiftserver v5.7.0.