Tips for deploying Deno locally?

Do we have a best practice for this? I want to deploy to my LAN only for a particular site. Maybe just “deno task preview” with a systemd service?
DAH
Deno AI Helper33d ago
I wasn't able to find the answer to your question in the official Deno documentation. However, based on your message, using deno task preview with a systemd service could be a viable approach for deploying a Deno application locally on your LAN. To set up a systemd service for your Deno application, you would typically create a service file with the necessary configuration to run your Deno app. Here's a basic example of what the service file might look like:
[Unit]
Description=My Deno App
After=network.target

[Service]
Type=simple
User=<your-user>
WorkingDirectory=/path/to/your/app
ExecStart=/usr/bin/deno run --allow-net server.ts
Restart=on-failure

[Install]
WantedBy=multi-user.target
[Unit]
Description=My Deno App
After=network.target

[Service]
Type=simple
User=<your-user>
WorkingDirectory=/path/to/your/app
ExecStart=/usr/bin/deno run --allow-net server.ts
Restart=on-failure

[Install]
WantedBy=multi-user.target
Replace <your-user> with the user you want the service to run under, and /path/to/your/app with the actual path to your Deno application. The ExecStart line should point to the Deno executable and include the necessary permissions and the entry point script for your application. Please note that this advice is not based on the Deno documentation, and you should double-check the accuracy of this advice, especially the Deno command and the permissions it requires, which can vary depending on your application's needs. Remember to enable and start your systemd service using the following commands:
sudo systemctl enable my-deno-app.service
sudo systemctl start my-deno-app.service
sudo systemctl enable my-deno-app.service
sudo systemctl start my-deno-app.service
Make sure to replace my-deno-app.service with the actual name of your service file. For a LAN deployment, ensure that your firewall and network settings allow traffic to the port your Deno application is listening on. Again, since this is not from the official documentation, I recommend testing this setup thoroughly and consulting additional resources or the Deno community
N
NDH33d ago
You may be interested in PUP. https://github.com/Hexagon/pup
GitHub
GitHub - Hexagon/pup: Universal process manager built in Deno
Universal process manager built in Deno. Contribute to Hexagon/pup development by creating an account on GitHub.
E
Evan33d ago
Ah that could work. Thanks!