jkwchui
I have a simple LiveView app that
- write user input to a temporary markup file (
content.typ), - drops to
System.cmd/2to process this markup with a CLI (typst), and - deliver the output (
content.png) to the client
In dev, I specify the path for the temporary files as
Application.app_dir(:typeset, "priv/static/uploads/")
and this works on my machine™.
I then have this dockerized and deployed on Fly, copying the Typst CLI to /bin and verified the CLI works by ssh in.
However, the temp files are now written to a directory that does not exist.
** (File.Error) could not write to file "/app/_build/prod/lib/typeset/priv/static/uploads/content.typ"
What is the proper way of handling temporary files, to be processed with a CLI, when deploying?
Trending in Questions
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
Hello,
I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
Hi everyone,
I am toying with the idea of building a “match maker” for giving personal help to people that wants to start coding.
I sta...
New
Documentation
While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
So my question is quite simple and i have found no conclusive answer on forum, google or AI.
Should we use :erlang.float for Integer to ...
New
I recently noticed that Elixir’s Logger defaults its primary log level to :debug when no :logger, :level application configuration is pre...
New
apply_graft/2 doesn’t rewrite an add_many sub-workflow’s deps on an add step. Grafted jobs cancel with “upstream job was deleted”
Version...
New
Other Trending Topics
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Hi everyone!
The first release candidate for the Expert language server project is now available!
We’ve published a press release detai...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixirconf-us
- #ai
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #hex
- #security










Showing Posts 1 to 9- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
LostKobrakai
jkwchui
Thank you @LostKobrakai.
For future readers: you’d use
System.tmp_dir/0for the path. So if you want to write acontent.png, it would go toYou can tell Phoenix to serve these as static files by adding a plug in
MyAppWeb.Endpointimmediately after the onlyPlug.Static:LostKobrakai
Giving people access to all your system tmp files is not a good idea. You want to scope this to a nested folder for your application.
jkwchui
This is a follow-up question on static files.
I have now deployed the little LiveView (on Fly: Typeset · Phoenix Framework) and on its own it’s all dandy. The plan was to make this into an iFrame embed in Wordpress, so this follows the recipe How to: Embed a LiveView via iframe and goes through its own pipeline.
I mapped this to a custom domain: Typeset · Phoenix Framework and the same app falls apart with this error:
__phoenix_reload_status__is part ofPhoenix.LiveView.Static, but I don’t understand why this is causing an issue only when it’s visited on the custom domain. There is a separate socket with its own @session_optionsand this should be very permissive?
EDIT: this is about
check_origin, related to: Phoenix LiveView constantly refreshes with custom domain - Phoenix - Fly.ioHermanverschooten
I am also using Typst in a couple of projects, that’s why I assembled a Hex package that uses a Rust nif so you don’t have to shell out, or use a temporary file.
D4no0
Is the rust API you are using public?
From the documentation it seems like typst was designed as a self-contained product rather than a rust library (even if implemented in rust).
Hermanverschooten
jkwchui
Thanks — I did check out
ex_typst. I shell out (necessitating the temporary file) because I’m using the CLI to generate transparent PNGs, and also (in the future) usetypst queryfrom the CLI to extract parameters from the run.(It was a while since I did the earlier expts; with the PDF, the only way I can get a clean transparent PNG back out was to Mogrify it with peculiar flags… again from the CLI.)
Hermanverschooten
Each case is different.