Skip to content

Commit

Permalink
setup dev kamal config
Browse files Browse the repository at this point in the history
  • Loading branch information
briankariuki committed Nov 28, 2024
1 parent 0fcae3f commit 2ad81ad
Show file tree
Hide file tree
Showing 6 changed files with 101 additions and 53 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,5 @@ npm-debug.log

.env.test
.env.dev
.env

19 changes: 0 additions & 19 deletions .kamal/secrets

This file was deleted.

2 changes: 2 additions & 0 deletions .kamal/secrets-common
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
KAMAL_REGISTRY_USERNAME=$KAMAL_REGISTRY_USERNAME
KAMAL_REGISTRY_PASSWORD=$KAMAL_REGISTRY_PASSWORD
7 changes: 7 additions & 0 deletions .kamal/secrets.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
SERVER_IP=$DEV_SERVER_IP
SECRET_KEY_BASE=$DEV_SECRET_KEY_BASE
DATABASE_URL=$DEV_DATABASE_URL
PHX_HOST=$DEV_PHX_HOST
PORT=$DEV_PORT
FILE_VOLUME_PATH=$FILE_VOLUME_PATH
DISABLE_ML_FEATURES=$DISABLE_ML_FEATURES
73 changes: 73 additions & 0 deletions config/deploy.dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Name of your application. Used to uniquely configure containers.
service: animina

<% require "dotenv"; Dotenv.load(".env") %>

# Name of the container image.
image: animina/animina

# Deploy to these servers.
servers:
web:
hosts:
- <%= ENV["DEV_SERVER_IP"] %>
options:
publish: PORT:4000
proxy: false

# Credentials for your image host.
registry:
server: ghcr.io
username:
- KAMAL_REGISTRY_USERNAME
# Always use an access token rather than real password (pulled from .kamal/secrets).
password:
- KAMAL_REGISTRY_PASSWORD

# Configure builder setup.
# builder:
# arch: amd64

builder:
cache:
type: registry
arch:
- amd64
- arm64

# Inject ENV variables into containers (secrets come from .kamal/secrets).
env:
clear:
PORT: 4000
MIX_ENV: prod
secret:
- <%= ENV["DEV_DATABASE_URL"] %>
- <%= ENV["DEV_SECRET_KEY_BASE"] %>
- <%= ENV["DEV_PHX_HOST"] %>
- <%= ENV["DISABLE_ML_FEATURES"] %>
# Aliases are triggered with "bin/kamal <alias>". You can overwrite arguments on invocation:
# "bin/kamal logs -r job" will tail logs from the first server in the job section.
#
# aliases:
# shell: app exec --interactive --reuse "bash"

# Use a different ssh user than root
#
ssh:
user: root
# Use a persistent storage volume.
#
# volumes:
# - "app_storage:/app/storage"

# Bridge fingerprinted assets, like JS and CSS, between versions to avoid
# hitting 404 on in-flight requests. Combines all files from new and old
# version inside the asset_path.
#
# asset_path: /app/public/assets

# Configure rolling deploys by setting a wait time between batches of restarts.
#
# boot:
# limit: 10 # Can also specify as a percentage of total hosts, such as "25%"
# wait: 2
52 changes: 18 additions & 34 deletions config/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,33 @@ image: animina/animina

# Deploy to these servers.
servers:
- 192.168.0.1

proxy:
ssl: false
host: animina.de
# Proxy connects to your container on port 80 by default.
app_port: 4000
web:
hosts:
- SERVER_IP
options:
publish: PORT:4000
proxy: false
# - SERVER_IP

# Credentials for your image host.
registry:
server: ghcr.io
username: my-user

username:
- KAMAL_REGISTRY_USERNAME
# Always use an access token rather than real password (pulled from .kamal/secrets).
password:
- KAMAL_REGISTRY_PASSWORD

# Configure builder setup.
# builder:
# arch: amd64

builder:
arch: amd64
cache:
type: registry
arch:
- amd64
- arm64

# Inject ENV variables into containers (secrets come from .kamal/secrets).
env:
Expand All @@ -36,6 +43,7 @@ env:
- DATABASE_URL
- SECRET_KEY_BASE
- PHX_HOST
- DISABLE_ML_FEATURES
# Aliases are triggered with "bin/kamal <alias>". You can overwrite arguments on invocation:
# "bin/kamal logs -r job" will tail logs from the first server in the job section.
#
Expand Down Expand Up @@ -63,27 +71,3 @@ env:
# boot:
# limit: 10 # Can also specify as a percentage of total hosts, such as "25%"
# wait: 2

# Use accessory services (secrets come from .kamal/secrets).
#
# accessories:
# db:
# image: mysql:8.0
# host: 192.168.0.2
# port: 3306
# env:
# clear:
# MYSQL_ROOT_HOST: '%'
# secret:
# - MYSQL_ROOT_PASSWORD
# files:
# - config/mysql/production.cnf:/etc/mysql/my.cnf
# - db/production.sql:/docker-entrypoint-initdb.d/setup.sql
# directories:
# - data:/var/lib/mysql
# redis:
# image: valkey/valkey:8
# host: 192.168.0.2
# port: 6379
# directories:
# - data:/data

0 comments on commit 2ad81ad

Please sign in to comment.