Basic Web project with Kitura on Swift
The Web basic starter contains an unopinionated set of files for web serving:
public/index.html
public/js/bundle.js
public/css/default.css
- On Linux, install the Swift toolchain version 3.1.1
- On macOS, install Xcode 8.3+
- Install Docker on your machine.
- Optional: Install IBM Cloud Developer Tools to build, run, and deploy using IDT
# Install needed dependencies:
idt install
# Build the docker image for your app:
idt build
# Run the app locally through docker:
idt run
# Deploy your app to IBM Cloud using Cloud Foundry:
idt deploy
# Deploy your app to IBM Cloud using Kubernetes:
idt deploy --target container
- Install the IBM Cloud CLI
- Install the plugin with:
bx plugin install dev -r bluemix
IBM Cloud DevOps services provides toolchains as a set of tool integrations that support development, deployment, and operations tasks inside Bluemix. The "Create Toolchain" button creates a DevOps toolchain and acts as a single-click deploy to IBM Cloud including provisioning all required services.
*Note you must publish your project to Github for this to work.
Your application configuration information is stored in config.json
. If you selected services added to your project, you will see Cloudant, Object Storage, and other services with their connection information such as username, password, and hostname listed here. This is useful for connecting to remote services while running your application locally.
When you push your application to IBM Cloud, however, these values are no longer used, and instead IBM Cloud automatically connects to those bound services through the use of environment variables. The config.json
file has been added to the .gitignore
file so you don't accidently check in the secret credentials.
The IBM Cloud development plugin makes it easy to compile and run your application if you do not have all of the tools installed on your computer yet. Your application will be compiled with Docker containers. To compile and run your app, run:
bx dev build
bx dev run
Once the Swift toolchain has been installed, you can compile a Swift project with:
swift build
Your sources will be compiled to your .build/debug
directory.
Your application is running at: http://localhost:8080/
in your browser.
To build and debug your app, run:
bx dev build --debug
bx dev debug