Skip to content

Commit 6813e5a

Browse files
committed
cloud docs
1 parent caa6024 commit 6813e5a

9 files changed

+245
-6
lines changed

docs/02-Kool-Cloud/01-Getting-Started.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ The [Kool Cloud](https://kool.dev/cloud) supports a wide range of features desig
22

33
The Kool.dev Cloud API was designed with the best developer experience in mind for deploying containers to the cloud. By leveraging your existing local environment structure in `docker-compose.yml` and adding a sane and intuitive configuration layer that will feel familiar from the first sight, our goal is to provide a best-in-class offering for cloud platform engineering. This platform allows you to leverage Kubernetes and orchestrate your web applications in the cloud without all the hassle.
44

5-
> **Enterprise**: you can use Kool.dev Cloud to deploy workloads to your own cloud vendor to keep things compliant - [contact us](mailto:[email protected]) for **"Bring your Own Cloud"** offer.
5+
> **Enterprise**: you can use Kool.dev Cloud to deploy workloads to your own cloud vendor to keep things compliant - [contact us](mailto:[email protected]) for the **"Bring your Own Cloud"** offer.
66
77
**kool cloud** is the CLI suite of commands that allows you to configure, deploy, access, and tail logs from the applications to the cloud via the Kool.dev Cloud API.
88

@@ -28,6 +28,6 @@ The Kool.dev Cloud API was designed with the best developer experience in mind f
2828

2929
---
3030

31-
Full documentation:
31+
Reference:
3232

33-
- [`kool.deploy.yml` Reference](/docs/02-Kool-Cloud/10-kool.deploy.yml-Reference.md)
33+
- [`kool.deploy.yml` Reference](/docs/02-Kool-Cloud/20-kool.deploy.yml-Reference.md)
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
This topic is usually the biggest source or problems and trial and error frustrations when deploying cloud native applications for the first time.
2+
3+
As much as the Kool.dev project and the whole community tries to help and facilitate container images building, it is a times ultimately an individual and singular process for your web application.
4+
5+
That being said there's no scape from having some knowledge on how to properly build your images to deploy your app to the cloud - or at least seek such knowledgable hands to assist your in this moment.
6+
7+
For the most basic cases - like if you are using one of our presets - you will have a great start point by using our utility along `kool cloud setup` - this command will inquiry you about basic options on building your container images.
8+
9+
### `kool cloud deploy` building images
10+
11+
`kool` CLI is going to handle the build of your images locally - in your own host system. That means it's required that the environment where you are going to run `kool cloud deploy` have a working Docker-like engine running that can process successfully a `docker build ...` command.
12+
13+
The syntax configuration for building your deploy image for a given service on `kool.cloud.yml` is the very same as you use it locally on `docker-compose.yml`:
14+
15+
Check out the [Docker Compose `build` Documentation](https://docs.docker.com/compose/compose-file/compose-file-v3/#build) for reference.
16+
17+
```yaml
18+
services:
19+
app:
20+
# ...
21+
build: . # this uses the root folder as context, and expects a Dockerfile to exist on it
22+
```
23+
24+
or
25+
26+
```yaml
27+
services:
28+
app:
29+
# ...
30+
build:
31+
context: ./dir # changes the context folder
32+
dockerfile: Dockerfile-alternate # name a different file than default 'Dockerfile'
33+
args:
34+
buildno: 1 # define values for ARGS used in your Dockerfile
35+
```
36+
37+
Your image will be built locally when running the `kool` CLI for a deploy, and then pushed securely to Kool.dev Cloud registry to a repository dedicated to your app environment.
38+
39+
### Using a Private Registry
40+
41+
You may already have or use your own private registry for handling images. You are welcome to hold the build process apart from the `kool cloud deploy` step, and just use the already built images in your `kool.cloud.yml` file:
42+
43+
```yaml
44+
services:
45+
app:
46+
# ...
47+
image: myrepo-registry/my-built-image
48+
```
49+
50+
If that registry is private you need to provide Kool.dev Cloud with credentials to read from that repo. As this is not yet fully automated you can [ping us via email to `[email protected]`]([email protected]) to set it up for you.
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
Most application and frameworks nowadays will rely on environment variables to configure important aspects of its functions, mainly providing credentials and other secrets your app need to work and access other resources.
2+
3+
Kool.dev Cloud supports a few different ways you can define your environment variables for a given deploying container, so pick the one that best suits you.
4+
5+
### Using `kool.deploy.env` file for deploy
6+
7+
`kool.deploy.env` should be a `.env` formatted file. You can point to it like this:
8+
9+
```yaml
10+
services:
11+
app:
12+
# ...
13+
environment: kool.deploy.env
14+
```
15+
16+
Upong deployment, all of the variables within that file will be parsed, placeholders replaced - if you have any - and then **each variable will become a real environment variables in the running container**.
17+
18+
This option is usually best suited for automated CI routines since you work your way to have a different `kool.deploy.env` file for each of your deploying environments (i.e staging and production).
19+
20+
### Using a plain YAML object for environment variables
21+
22+
```yaml
23+
services:
24+
app:
25+
# ...
26+
environment:
27+
FOO: bar
28+
```
29+
30+
You can simply use a YAML map of values that will become your environment variables in the running deployed container. This is handy sometimes when you have simple and not sensitive variables you want to add to a container for deploy.
31+
32+
### Build a `.env` file inside the running container
33+
34+
If you application does rely and requires a `.env` file existing in the running container you may achieve so by using the `env:` entry:
35+
36+
```yaml
37+
services:
38+
app:
39+
# ...
40+
41+
# 'env' is a different option that allows you to build a file inside your running container.
42+
env:
43+
source: kool.deploy.env
44+
target: .env
45+
```
46+
47+
This is useful for apps that have require the .env file, but you do not wish to have that built into your Docker image itself.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
All deployed environments will run under HTTPS. Kool.dev Cloud will automatically generate certificates for your environment the first time it is deployed using Let'sEncrypt engine.
2+
3+
You always need to provide the environment domain when running a deploy.
4+
5+
```bash
6+
kool cloud --token="<my token>" deploy --domain="my-app-domain.com"
7+
```
8+
9+
You can provide those values via environment variables as well if that's easier for you:
10+
11+
- `KOOL_API_TOKEN` for the access token.
12+
- `KOOL_DEPLOY_DOMAIN` for the domain environment you want to deploy to.
13+
14+
Important to notice: if you deploy to a new domain that doesn't currently exist in your Kool.dev Cloud panel, that is totally fine and will just create a very new environment for that domain.
15+
16+
### Test deployment domains
17+
18+
You are welcome to use a subdomain like `my-super-app.kool.cloud` on your staging or development environments. By using that you will have HTTPS certificates up and running instantly for that environment after first deploy.
19+
20+
### Production and custom domains
21+
22+
When you create an environment to be deployed using your own custom domain name, you will need to check out in the Kool.dev Cloud panel for that environment the instructions to where to point your A/CNAME for that domain.
23+
24+
HTTPS certificates will only be successfully generated once the DNS is correctly pointing your domain to Kool.dev Cloud.
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
Most of time the web applications you are going to deploy will usually have its own companying database.
2+
3+
Kool.dev Cloud offers two ways for you do deploy your databases.
4+
5+
1. Deploy databases as regular containers.
6+
1. Use a managed database on a shared structure.
7+
1. Use a dedicated Database Custom Resource (i.e RDS dedicated instance).
8+
9+
All of this options come with basic daily backup routines for your safety.
10+
11+
### Deploy Databases as Regular Containers
12+
13+
Deploying a container that is going to run your database is pretty straight forward - just like your have it in your local `docker-compose.yml` for your local environment, you can deploy that very same container. The benefit of this is you have full control at your container configuration and can use any type of database.
14+
15+
#### Caveats of deploying databases on containers are
16+
17+
- **Persistent disk storage**: by default deployed containers are ephemeral and DO NOT have any disk persistent storage. This may cause problems if you deploy a database and upon restart, all your data is lost. **You must make sure to incoude in your container deploy configuration a `persistent` disk storage**, so upon restarts your data is kept safe and is no longer ephemeral.
18+
- **Environment variables**: your database image may require specific environment variables to determine credentials and other settings. You need to make sure you set them correctly, different than your local ones.
19+
20+
### Managed Database in shared structure
21+
22+
This option is the easiest to get started - but currently only supports MySQL 8 database deployments.
23+
24+
If you have a MySQL database in your `docker-compose.yml`, you can just assign that service the `cloud: true` on your `kool.cloud.yml` and Kool.dev Cloud is going to setup a new database on a running shared RDS instance.
25+
26+
This managed options will provide you with variables placeholders for you to get a hold of the credentials automatically generated as well as the database name/host.
27+
28+
Here is the list of Kool.dev variables placeholders available and how you would use them in your environment variables definition to use the managed database:
29+
30+
```
31+
DB_HOST="{{KOOL_DATABASE_HOST}}"
32+
DB_PORT={{KOOL_DATABASE_PORT}}
33+
DB_DATABASE="{{KOOL_DATABASE_DATABASE}}"
34+
DB_USERNAME="{{KOOL_DATABASE_USERNAME}}"
35+
DB_PASSWORD="{{KOOL_DATABASE_PASSWORD}}"
36+
```
37+
38+
The placeholders always have the `{{PLACEHOLDER}}` syntax. When used anywhere in your `kool.cloud.yml` configuration they are going to be replaced by their managed values when deploying.
39+
40+
#### Caveats of using managed shared database
41+
42+
- Currently **only supports MySQL 8** deployments.
43+
- Being a shared resource, top performance is not guarenteed (unless you have it running in your own Cloud vendor account in the Enterprise offer).
44+
- Best suited for development and staging workloads.
45+
46+
### Dedicated Database Resource
47+
48+
You can have any sort of custom resource for your application, including dedicated databases (i.e RDS or ElastiCache).
49+
50+
As this is not yet fully automated you need to [contact our support to set it up](mailto:[email protected]) for you in your account.
51+
52+
One of the benefits is having total control of your set up not only on disk/computing performance, but as well as tailored backup and replication options.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
Containers were built to be ephemeral - and that is how we like them and how Kubernetes and all other container orchestrators usually work the best with them as well.
2+
3+
But at times we know that tradicional web applications may not be ready to switch to network-based object storage instead of local disk storage.
4+
5+
Kool.dev Cloud does offer you the ability to create persisted paths within your deployed containers.
6+
7+
```yaml
8+
services:
9+
app:
10+
# ...
11+
12+
# Tells your app's root folder so all other paths can be relative (optional).
13+
root: /app
14+
15+
# Containers are ephemeral, that means their filesystem do not persist across restarts.
16+
# If you want to persist stuff into the disk across deployments, you can do so by defining persistent paths here.
17+
persists:
18+
# Total size of the volume you want to attach to the running container.
19+
# This can be increased later, but it may take a while to apply the change.
20+
size: 10Gi
21+
# Paths to persist - within that single volume, you can have one or more paths
22+
# that are going to be mounted every time your containers are running. Note that
23+
# such mounts will be there for before/after hooks as well as daemon containers.
24+
paths:
25+
# The path within the container. Must be either aboslute or relative to the 'root' config.
26+
- path: /app/some/path/persisted
27+
# Tells the Deploy API to sync the folder from your built image to the persisted storage.
28+
# This is very helpful to start off with a known folder structure.
29+
sync: true
30+
# Tells what user and group should own the persisted folder (only used when sync: true)
31+
chown: user:group
32+
```
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
You have the ability to define hooks to run before or after every deploy you make.
2+
3+
These hooks will run using the very same image that is being deployed. This is usually needed for common routines, as for example running database migrations, sending alerts of updates to some other service, etc.
4+
5+
To illustrate the options you have on `kool.cloud.yml` file:
6+
7+
```yaml
8+
services:
9+
app:
10+
# ...
11+
12+
# The 'before' hook is a special section where we can define commands to be executed
13+
# right before a new deployment happens.
14+
before:
15+
- [ sh, run-database-migrations.sh, arg1, arg2 ]
16+
17+
# The 'after' hook is a special section where we can define procedures to be executed
18+
# right after a new deployment finishes.
19+
after:
20+
- [ sh, run-cache-version-update.sh, arg1, arg2 ]
21+
```
22+
23+
### Failures on lifecycle hooks
24+
25+
Please notice that these lifecycle hooks are required in order for the new deploy to be successfull - this mean that **if any of them fail** - either `before` or `after` new deployed contianer versions are running - **the whole deploy is going to be rolledback**. As you can imagine this poses a challange specially on database migrations since they can be problematic and not backwards compatible with previously running container version.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Most of real world web applications will go beyond just computing containers with your code - there's a vast myriad of other resources you will eventually need like dedicated database services (i.e RDS), replication, object storage (i.e S3), CDN (i.e CloudFront) just to name a few.
2+
3+
Kool.dev Cloud team is ready to set it up for you when needed - providing you the Infrastructure-as-Code to live close to your application. While this is not built into our panel for self-service usage, you can just [ping us via email with your needs](mailto:[email protected]) and we will work through your request.
4+
5+
If you lack the DevOps expertise to determine your needs, we also have consulting services available to best serve you.

docs/02-Kool-Cloud/10-kool.cloud.yml-Reference.md renamed to docs/02-Kool-Cloud/20-kool.cloud.yml-Reference.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,14 @@ Here's an example of `kool.cloud.yml` file showcasing all the features and confi
3535
services:
3636
app:
3737
# Applications usually will require a special image built for deployment.
38-
build: Dockerfile
38+
# Reference: https://docs.docker.com/compose/compose-file/compose-file-v3/#build
39+
build: .
3940
4041
# Tells Kool Cloud that this service is accessible through the deployment URL.
4142
# Note: only one service can be set to be public.
43+
public: true # simply defining true is enough to most cases where your `expose` port will be used for routing incoming HTTP requests.
44+
45+
# Another option is advanced definition:
4246
public:
4347
# Tells the port that should be used for routing incoming HTTP traffic.
4448
- port: 80
@@ -50,7 +54,7 @@ services:
5054
path: /ws
5155

5256
# Tells what port the app will listen to (optional).
53-
port: 80
57+
expose: 80
5458

5559
# Tells your app's root folder so all other paths can be relative (optional).
5660
root: /app
@@ -74,7 +78,7 @@ services:
7478

7579
# By default, Kool Cloud will rollout new deployments in a blue-green fashion.
7680
# If you want to disable it and make sure the current running container
77-
# stopped before the new one is created, set 'recreate: true'.
81+
# is stopped before the new one is created, set 'recreate: true'.
7882
recreate: false
7983

8084
# Sometimes you may make changes to your app that wouldn't necessarily trigger

0 commit comments

Comments
 (0)