File tree Expand file tree Collapse file tree 2 files changed +30
-4
lines changed Expand file tree Collapse file tree 2 files changed +30
-4
lines changed Original file line number Diff line number Diff line change @@ -7,13 +7,33 @@ ifndef SPINCFG
7
7
SPINCFG = spin.toml
8
8
endif
9
9
10
- all : local
10
+ ifndef SPINVER
11
+ SPINVER = v0.4.0
12
+ endif
13
+
14
+ ifndef ARCH
15
+ ARCH = amd64
16
+ endif
17
+
18
+ ifndef OS
19
+ OS = linux
20
+ endif
11
21
12
- local : wasm/tpl.wasm
22
+ ifndef SPINBIN
23
+ SPINBIN = https://github.com/fermyon/spin/releases/download/$(SPINVER ) /spin-$(SPINVER ) -$(OS ) -$(ARCH ) .tar.gz
24
+ endif
25
+
26
+ .PHONY : run watch deploy container
27
+
28
+ all : run
29
+ run : wasm/tpl.wasm
13
30
sh -c ' $(SPINFLAGS) spin up --file $(SPINCFG)'
14
31
15
32
watch : wasm/tpl.wasm
16
33
nodemon --watch cgi-bin --watch www --watch lib --ext pl,html,php --verbose --legacy-watch --signal SIGINT --exec ' $(SPINFLAGS) spin up --file $(SPINCFG)'
17
34
35
+ container :
36
+ nixpacks build . --name php --pkgs wget --install-cmd ' wget -O spin.tar.gz $(SPINBIN) && tar xvf spin.tar.gz' --start-cmd ' ./spin up --file spin.toml'
37
+
18
38
deploy : wasm/tpl.wasm
19
- ssh ubuntu@php.energy ' cd php && git pull && sudo systemctl restart php'
39
+ ssh ubuntu@php.energy ' cd php && git pull && sudo systemctl restart php'
Original file line number Diff line number Diff line change @@ -13,7 +13,8 @@ Head on over to our beautiful homepage at [php.energy](https://php.energy/). Sou
13
13
14
14
0 . ~~ Reconsider whether you really want to do this~~ .
15
15
1 . [ Install Spin] ( https://spin.fermyon.dev/quickstart/ ) .
16
- 1 . For hot reloading, [ install nodemon] ( https://www.npmjs.com/package/nodemon ) (optional).
16
+ 2 . For hot reloading, [ install nodemon] ( https://www.npmjs.com/package/nodemon ) (optional).
17
+ 3 . For building the container image, [ install nixpacks] ( https://nixpacks.com/docs/getting-started ) .
17
18
2 . Clone this repo.
18
19
3 . Configure the www root in ` spin.toml `
19
20
4 . Put PHP scripts or Prolog programs in ` public_html ` or ` cgi-bin ` .
@@ -22,6 +23,11 @@ Head on over to our beautiful homepage at [php.energy](https://php.energy/). Sou
22
23
- Run server with ` make ` or ` spin up ` .
23
24
- Or use ` make watch ` for hot reloading.
24
25
26
+ ## Build
27
+ 1 . [ Install nixpacks] ( https://nixpacks.com/docs/getting-started ) .
28
+ 2 . Build a Docker container image with ` make container ` .
29
+ 3 . See Makefile for settings.
30
+
25
31
## How does it work?
26
32
27
33
It just runs the WebAssembly version of Trealla Prolog and writes CGI ([ RFC 3875] ( https://datatracker.ietf.org/doc/html/rfc3875 ) ) output to stdout.
You can’t perform that action at this time.
0 commit comments