-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Running directly to reduce memory overheads
- Loading branch information
Showing
2 changed files
with
46 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
use bf | ||
|
||
# Run preflight checks before executing process | ||
export def preflight [...args] { | ||
# load environment | ||
bf env load | ||
|
||
# manually set executing script | ||
bf env set X aspnet/run | ||
|
||
# verify ASPNET_ASSEMBLY is set | ||
let assembly = bf env ASPNET_ASSEMBLY | ||
let dir_live = bf env ASPNET_APP_LIVE | ||
|
||
# verify assembly exists | ||
let assembly_path = $"($dir_live)/($assembly)" | ||
if (bf fs is_not_file $assembly_path) { | ||
bf write notok $"($assembly_path) not found." | ||
go_to_sleep 30sec | ||
exit 66 | ||
} | ||
|
||
# start application | ||
bf write "Starting ASP.NET application." | ||
bf write debug $" .. ($assembly_path)." | ||
} | ||
|
||
# Sleep the thread for a set about of time | ||
def go_to_sleep [ | ||
for: duration # Amount of time to sleep for | ||
] { | ||
bf write $"Sleeping for ($for)." | ||
sleep $for | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,17 @@ | ||
#!/usr/bin/nu | ||
#!/bin/withenv sh | ||
|
||
use bf | ||
use bf-s6 | ||
bf env load -x aspnet | ||
set -euo pipefail | ||
|
||
# Run ASP.NET application | ||
def main [...args] { | ||
# verify ASPNET_ASSEMBLY is set | ||
let assembly = bf env ASPNET_ASSEMBLY | ||
let dir_live = bf env ASPNET_APP_LIVE | ||
|
||
# verify assembly exists | ||
let assembly_path = $"($dir_live)/($assembly)" | ||
if (bf fs is_not_file $assembly_path) { | ||
bf write notok $"($assembly_path) not found." | ||
go_to_sleep 30sec | ||
exit 0 | ||
} | ||
#====================================================================================================================== | ||
# Run preflight checks. | ||
#====================================================================================================================== | ||
|
||
# start application | ||
bf write "Starting ASP.NET application." | ||
bf write debug $" .. ($assembly_path)." | ||
^bf-x-as www dotnet $assembly_path | ||
} | ||
nu -c "use bf-aspnet run ; run preflight" | ||
|
||
# Sleep the thread for a set about of time | ||
def go_to_sleep [ | ||
for: duration # Amount of time to sleep for | ||
] { | ||
bf write $"Sleeping for ($for)." | ||
sleep $for | ||
} | ||
|
||
#====================================================================================================================== | ||
# Start dotnet application. | ||
#====================================================================================================================== | ||
|
||
s6-setuidgid www dotnet ${BF_ASPNET_APP_LIVE}/${BF_ASPNET_ASSEMBLY} |