Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# Kamal deploy tips
Deploy tool using docker https://kamal-deploy.org/
Create simple server on lxc
## Installation
Install using ruby gem, currently version 2.5.0
```
gem install kamal
```
create `config/deploy.yml` and `.kamal/secrets` file
```
kamal init
```
TODO: try using kamal from docker https://kamal-deploy.org/docs/installation/dockerized/
## Make docker image
Before deploy you can test your image, for example
```
# Dockerfile
FROM nginx:latest
COPY ./public/index.html /usr/share/nginx/html
```
and build image and run container with
```
docker build . -t sample-server
docker run -p 80:80 sample-server
```
Open http://localhost:80 and you should see `hello`
```
curl localhost:80
hello
```
Remove image
```
docker rmi sample-server
```
Also you can test with docker compose
```
# docker-compose.yml
services:
web:
build:
context: .
ports:
- 80:80
```
run with
```
docker compose up
```
Open http://localhost:80 and you should see `hello`
```
curl localhost:80
hello
```
Remove image
```
docker compose down --rmi local
```
## Setup
We do not need docker on the server since kamal will automatically install it
```
kamal setup
```
https://kamal-deploy.org/docs/commands/deploy/
By default we use https://hub.docker.com/ to store the image so we need to export key used in `.kamal/secrets`
```
export KAMAL_REGISTRY_PASSWORD=dc....
```
Kamal deploy
```
kamal deploy
```
Note that build is based on latest COMMITED code so if you have some updates, you need to commit them before deploy.
* `image:` name of the container image should match name of the repository on registry server. For hub.docker.io is it `<username>/<repository>`. For ECR it is `<repository>`
## Destinations
https://kamal-deploy.org/docs/configuration/overview/#destinations