kamal
kamal copied to clipboard
Make configuration path configurable
I would like to be able to use MRSK in other projects and environments (ie. Laravel). While Laravel also stores it's project configuration in the /config folder, it uses .php files as opposed to .yml. Within the context of a Laravel app it would make more sense to me to store the deploy.yml file in the project root which is why I would like to be able to configure it.
Think this will be a nice issue for me to dabble with Ruby a bit. There are also quite a few directions we could take this in. I'm currently thinking about writing out a .mrskrc on init that will contain this and similar configuration settings in the future. Thoughts?
You can pass `-c` to specify a different path for the deploy configuration 👍
Originally posted by @dhh in https://github.com/mrsked/mrsk/issues/75#issuecomment-1454656935
Try with:
mv config/deploy.yml .mrskrc
mrsk deploy -c .mrskrc
It doesn't work with mrsk init -c .mrskrc though, so that's something thats needs a fix 🎉
config/deploy.yaml is hardcoded here:
https://github.com/mrsked/mrsk/blob/3026a92c9850be79f0e4f0f691552867bc0b14d6/lib/mrsk/cli/main.rb#L104
Thanks @kjellberg, missed that option. Let's park the idea of a .mrskrc configuration file for now and see whether other usecases arrive that may warrant adding something like that in the future.
Hi @99linesofcode you metioned Laravel. Do you have some example repo integrating Kamal with Laravel. Thanks and sorry if this a bit off-topic on this issue
Hi @andresgutgon,
No example repository unfortunately but here's the gist of what I did to deploy a Laravel application succesfully:
- Create a base image that copies your source code into
/appand host it on a container registry (for example on Github); - Add a healthcheck endpoint (i.e.
/up). I've used Spatie's Laravel Health; - Define your
deploy.ymland secrets; - Run Kamal. Here is the alias I used when it was still mrsk:
# mrsk
alias mrsk="docker run -it --rm -v $PWD:/workdir -v $HOME/.gitconfig:/root/.gitconfig -v $SSH_AUTH_SOCK:/ssh-agent -v /var/run/docker.sock:/var/run/docker.sock -e SSH_AUTH_SOCK=/ssh-agent ghcr.io/mrsked/mrsk:latest"
Below is an example of the deploy.yml I used:
service: APP_NAME
image: GITHUB_ACCOUNT/IMAGE_NAME
servers:
- SERVER_IP
registry:
server: ghcr.io
username: 99linesofcode
password:
- MRSK_REGISTRY_PASSWORD
builder:
multiarch: false
healthcheck:
path: /up
port: 80
Good luck!
Thanks! I'll try and let you know