https://linen.dev logo
Deploy static files with gitignore.
# help
e
I'm developing a software using elm and axum. So I was able to deploy backend and frontend with shuttle-static. but I want to add static dir into .gitignore. Please teach me how to deploy static files with .gitignore. and best practice of frontend and backend directory design.
a
Hi there 😁 I believe adding static directory to gitignore stops the static files being deployed at the moment, unless that's been changed
personally I like to keep the back and front ends in two separate folders - merging them together will probably cause some issues with finding things
e
Hi @agreeable-painting-48846 πŸ˜„ Thanks for answering my question and best practice of dir design. I think that I should add build artifacts into .gitignore because I want to suppress diffs every build frontend. If I gitignore as you say, I get an error.
Copy code
ERROR {error="Run error: Custom error: failed to provision shuttle_static_folder :: StaticFolder"} shuttle_deployer::deployment::run: service startup encountered an error
Can I prevent this?
a
At the moment I'm not sure if you can ignore static folder and still be able to deploy. This will probably be changed at some point in the future but... until then, yea πŸ˜… someone else may be able to better comment on this
e
I wrote the following Makefile to avoid the problem. Directory
Copy code
.
β”œβ”€β”€ backend
└── frontend
    └── public
Makefile
Copy code
.PHONY: deploy
deploy:
    cp -r ../frontend/public ./
    git add public/ && git commit -m 'add public to deploy static.'
    -@cargo shuttle deploy
    git reset --hard HEAD^
If is there a better solution, please tell me. because I think that this ad-hoc Makefile is dangerous.
k
This does seem like a bug, and something we should look into. In the meantime maybe you could un-ignore the static folder before you deploy, deploy with
cargo shuttle deploy --allow-dirty
, then ignore it again?
e
Thanks for answering. Sounds good for now. Looking forward to future shuttlesπŸ‘
k
While it's not solved, we found a pretty good workaround for this issue. You can use a
.ignore
file to override the gitignore, so it's still ignored by git but not by the shuttle builder. Example:
a
It worked fine with .ignore. Thanks!
3 Views