aboutsummaryrefslogtreecommitdiff
path: root/ci/release.taskfile.yaml
blob: 41fec6190e9379dbb3dc668a6b376da3bfdef006 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# https://taskfile.dev

#Inlcuded taskfile for object cache server that is used to produce
#ci builds for standalone caching servers

version: "3"

vars:
  SSL_DIR: "ssl"
  DATA_DIR: "data"
  DEFAULT_EC_CURVE: "secp384r1"
  PASS_PEPPER_SIZE: 64

tasks:
  default:
    desc: "Runs the server in realease mode"
    interactive: true
    cmds:
    - task: run

  run:
    desc: "Runs the server in release mode"
    silent: true
    interactive: true
    env: 
      #libraries intentionally do not have extensions, for cross-platform compatibility, the server will load them regardless
      VNLIB_SHARED_HEAP_FILE_PATH: lib/vnlib_rpmalloc.dll
      VNLIB_ARGON2_DLL_PATH: lib/argon2.dll
    cmds:
    - cmd: dotnet webserver/VNLib.WebServer.dll --config config/config.json {{ .CLI_ARGS }}

  setup-apt:
     desc: "Performs initial setup on Debian apt amd64 based machines"
     silent: true
     cmds:
     - apt update
     - apt install -y dotnet-runtime-8.0 gcc cmake curl
     - task: setup
     - echo "Setup complete"

  setup-dnf:
     desc: "Performs initial setup on Fedora/Redhat amd (dnf) based machines"
     silent: true
     cmds:
     - dnf update
     - dnf install -y dotnet-runtime-8.0 gcc cmake curl
     - task: setup
     - echo "Setup complete"

  setup-apk:
     desc: "Performs initial setup using the APK package manager for amd64 based machines"
     silent: true
     cmds:
     - apk update
     - apk add --no-cache dotnet8-runtime build-base cmake curl
     - task: setup
     - echo "Setup complete"

  setup:
    desc: "Performs platform agnostic setup tasks without installing tools (no sudo needed)"
    cmds:
    #build rpmalloc lib
    - task: build-rpmalloc
    - task: build-argon2
    - task: build-compress
  
    #setup ssl dir
    - cmd: mkdir ssl/
      platforms: [ linux, darwin ]
      ignore_error: true
    - cmd: powershell -Command "mkdir ssl/"
      platforms: [ windows/amd64 ]
      ignore_error: true

  create-pepper:
    desc: "Generates a new pepper for hashing passwords."
    vars:
      PEPPER_FILE: "secrets/password-pepper.txt"
    cmds:
    - cmd: mkdir secrets/
      platforms: [ linux, darwin ]
      ignore_error: true
    - cmd: powershell -Command "mkdir secrets/"
      platforms: [ windows/amd64 ]
      ignore_error: true

    - cmd: openssl rand -base64 {{ .PASS_PEPPER_SIZE }} > {{ .PEPPER_FILE }}
      platforms: [ linux, darwin ]

    - echo "DO NOT EVER LOSE OR UPDATE THIS FILE!"

  create-cert:
    desc: "Genereates a new self-signed TLS certificate"
    interactive: true
    cmds:
    - openssl req -new -x509 -days 365 -keyout {{.SSL_DIR}}/key.pem -out {{.SSL_DIR}}/cert.pem -newkey ec -pkeyopt ec_paramgen_curve:{{.DEFAULT_EC_CURVE}} --nodes

  build-rpmalloc:
    internal: true
    dir: 'lib/'
    cmds:
    #build rpmalloc library for linux/mac
    - cmd: cd vnlib_rpmalloc/ && task && cp build/libvn_rpmalloc{{if eq OS "darwin"}}.dylib{{else}}.so{{end}} ../vnlib_rpmalloc.dll
      platforms: [ linux, darwin ]
      
    #for windows just copy the existing dll
    - cmd: powershell -Command "cp vnlib_rpmalloc/vnlib_rpmalloc.dll vnlib_rpmalloc.dll"
      platforms: [ windows/amd64 ]

  build-argon2:
    internal: true
    dir: 'lib/'
    cmds:
      #build argon2 library for linux/mac
    - cmd: cd argon2/ && task && cp build/libargon2{{if eq OS "darwin"}}.dylib{{else}}.so{{end}} ../argon2.dll
      platforms: [ linux, darwin ]
      
      #for windows just copy the existing dll
    - cmd: powershell -Command "cp argon2/argon2.dll argon2.dll"
      platforms: [ windows/amd64 ]

  build-compress:
    internal: true
    dir: 'lib/'
    cmds:
    #build the native compressor library for linux/mac
    - cmd: cd vnlib_compress/ 
        && task 
        && cp build/libvn_compress{{if eq OS "darwin"}}.dylib{{else}}.so{{end}} ../vnlib_compress.dll
      platforms: [ linux, darwin ]

    #windows now supports pre-compiled libs
    - cmd: powershell cp vnlib_compress/vnlib_compress.dll vnlib_compress.dll
      platforms: [ windows/amd64 ]