mirror of
https://github.com/mentos1386/zdravko.git
synced 2024-11-22 07:43:33 +00:00
feat: deploy to flyio
This commit is contained in:
parent
e45fc81faa
commit
c1fbd561bb
7 changed files with 76 additions and 3 deletions
14
.github/workflows/deploy.yaml
vendored
Normal file
14
.github/workflows/deploy.yaml
vendored
Normal file
|
@ -0,0 +1,14 @@
|
|||
name: Deploy
|
||||
on: [push]
|
||||
branch: main
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- uses: superfly/flyctl-actions/setup-flyctl@v1.5
|
||||
- run: flyctl deploy --remote-only
|
||||
env:
|
||||
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
|
|
@ -11,6 +11,7 @@ Mostly just a project to test [temporal.io](https://temporal.io/).
|
|||
- [ ] Some nice UI to try out [htmx](https://htmx.org/).
|
||||
|
||||
![Screenshot](docs/screenshot.png)
|
||||
Demo is available at https://zdravko.fly.io.
|
||||
|
||||
# Development
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ package main
|
|||
import (
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
|
||||
|
@ -11,6 +12,11 @@ import (
|
|||
)
|
||||
|
||||
func main() {
|
||||
port := os.Getenv("PORT")
|
||||
if port == "" {
|
||||
port = "8000"
|
||||
}
|
||||
|
||||
r := mux.NewRouter()
|
||||
|
||||
// Server static files
|
||||
|
@ -19,6 +25,6 @@ func main() {
|
|||
r.HandleFunc("/", pages.Index).Methods("GET")
|
||||
r.HandleFunc("/settings", pages.Settings).Methods("GET")
|
||||
|
||||
log.Println("Server started on :8000")
|
||||
log.Fatal(http.ListenAndServe(":8000", r))
|
||||
log.Println("Server started on", port)
|
||||
log.Fatal(http.ListenAndServe(":"+port, r))
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
"go@1.21",
|
||||
"temporal-cli@latest",
|
||||
"watchexec@latest",
|
||||
"tailwindcss@latest"
|
||||
"tailwindcss@latest",
|
||||
"flyctl@latest"
|
||||
]
|
||||
}
|
||||
|
|
20
devbox.lock
20
devbox.lock
|
@ -1,6 +1,26 @@
|
|||
{
|
||||
"lockfile_version": "1",
|
||||
"packages": {
|
||||
"flyctl@latest": {
|
||||
"last_modified": "2024-02-05T02:15:44Z",
|
||||
"resolved": "github:NixOS/nixpkgs/0a254180b4cad6be45aa46dce896bdb8db5d2930#flyctl",
|
||||
"source": "devbox-search",
|
||||
"version": "0.1.147",
|
||||
"systems": {
|
||||
"aarch64-darwin": {
|
||||
"store_path": "/nix/store/r2nqhmbcmijhcc1saz41hcxz8rr4b41x-flyctl-0.1.147"
|
||||
},
|
||||
"aarch64-linux": {
|
||||
"store_path": "/nix/store/04xazp0avkk26zyf50prl1mskflfpb86-flyctl-0.1.147"
|
||||
},
|
||||
"x86_64-darwin": {
|
||||
"store_path": "/nix/store/4zbndlj7m4wy834qppl2rir9fcwrzji4-flyctl-0.1.147"
|
||||
},
|
||||
"x86_64-linux": {
|
||||
"store_path": "/nix/store/8cfzmq9dka6vaah9j2lpdpbkpm4q0i4m-flyctl-0.1.147"
|
||||
}
|
||||
}
|
||||
},
|
||||
"go@1.21": {
|
||||
"last_modified": "2024-01-27T14:55:31Z",
|
||||
"resolved": "github:NixOS/nixpkgs/160b762eda6d139ac10ae081f8f78d640dd523eb#go",
|
||||
|
|
27
fly.toml
Normal file
27
fly.toml
Normal file
|
@ -0,0 +1,27 @@
|
|||
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
|
||||
|
||||
app = 'zdravko'
|
||||
primary_region = 'waw'
|
||||
|
||||
[build]
|
||||
builder = 'paketobuildpacks/builder:base'
|
||||
buildpacks = ['gcr.io/paketo-buildpacks/go']
|
||||
|
||||
[env]
|
||||
PORT = '8080'
|
||||
|
||||
[processes]
|
||||
server = "server"
|
||||
#worker = "worker"
|
||||
|
||||
[http_service]
|
||||
processes = ["server"]
|
||||
internal_port = 8080
|
||||
force_https = true
|
||||
auto_stop_machines = true
|
||||
auto_start_machines = true
|
||||
|
||||
[[vm]]
|
||||
cpu_kind = 'shared'
|
||||
cpus = 1
|
||||
memory_mb = 256
|
4
justfile
4
justfile
|
@ -38,3 +38,7 @@ run-worker:
|
|||
# Run full development environment
|
||||
run:
|
||||
devbox services up
|
||||
|
||||
# Deploy the application to fly.io
|
||||
deploy:
|
||||
fly deploy
|
||||
|
|
Loading…
Reference in a new issue