Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update hosting documentation #552

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/Hosting/AWS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Amazon Web Services
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would just let this be # AWS 😄


Similar to what is found in the [Azure hosting tutorial](./Azure.md), Pode.Web does not run in stateless functions like AWS Lambdas. It can be run within containers though.
33 changes: 33 additions & 0 deletions docs/Hosting/Azure.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Azure

If you want to run Pode.Web in the Azure environment, your only option is to use Azure Container Apps.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'll be worth mentioning the other options available in Azure as well, as ACA is just one:

  • Azure Web Apps (think this might have changed names now? but is basically just IIS)
  • AKS (just docker again really)
  • Azure VMs (Linux with NGINX, etc. and Windows with IIS - or for both services/tasks)

This will likely be the same for AWS as well, with EKS and EC2. I'm OK with just stating that Pode.Web works with these offerings.


## Azure Functions

Pode.Web is a stateful/interactive framework. Because it relies on a running server component and because startup performance is quite prohibitive, it cannot run in stateless mode in Azure Functions.

## Azure Container Apps

Using Azure Container Apps is very similar to using Docker to host Pode.Web. You can even automate the Docker Image build process within a github workflow so that you commit and an image is built and pushed to Azure ready to go. To get started, all you really need is a working dockerfile in your github repo. You can even have the build process pull extra modules from the PSGallery, like AzBobbyTables in this example:

```
# pull down the pode image
FROM badgerati/pode.web:latest

# or use the following for GitHub
# FROM docker.pkg.github.com/badgerati/pode.web/pode.web:latest

# copy over the local files to the container
COPY . /usr/src/app/

# expose the port
EXPOSE 80

# run the server
RUN pwsh -c "Install-Module AzBobbyTables -Force"
CMD [ "pwsh", "-c", "cd /usr/src/app; ./server.ps1" ]
```

Then you just need to create a deployment workflow from the Azure Container Apps Deployment Center. In Container Apps, you can do things like set ENV variables for your secrets.

But be warned, cold starts for PowerShell in Azure (even this Container App) are quite slow: around 30s. This solution with Azure Container Apps will need to either be always running or tolerant towards these cold starts.
Loading