├── .dockerignore ├── .gitignore ├── Cargo.lock ├── Cargo.toml ├── Dockerfile ├── README.md ├── fly.toml └── src └── main.rs /.dockerignore: -------------------------------------------------------------------------------- 1 | /target -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | -------------------------------------------------------------------------------- /Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | [[package]] 4 | name = "autocfg" 5 | version = "1.0.1" 6 | source = "registry+https://github.com/rust-lang/crates.io-index" 7 | checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" 8 | 9 | [[package]] 10 | name = "base64" 11 | version = "0.13.0" 12 | source = "registry+https://github.com/rust-lang/crates.io-index" 13 | checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" 14 | 15 | [[package]] 16 | name = "bitflags" 17 | version = "1.2.1" 18 | source = "registry+https://github.com/rust-lang/crates.io-index" 19 | checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" 20 | 21 | [[package]] 22 | name = "block-buffer" 23 | version = "0.9.0" 24 | source = "registry+https://github.com/rust-lang/crates.io-index" 25 | checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" 26 | dependencies = [ 27 | "generic-array", 28 | ] 29 | 30 | [[package]] 31 | name = "buf_redux" 32 | version = "0.8.4" 33 | source = "registry+https://github.com/rust-lang/crates.io-index" 34 | checksum = "b953a6887648bb07a535631f2bc00fbdb2a2216f135552cb3f534ed136b9c07f" 35 | dependencies = [ 36 | "memchr", 37 | "safemem", 38 | ] 39 | 40 | [[package]] 41 | name = "byteorder" 42 | version = "1.4.3" 43 | source = "registry+https://github.com/rust-lang/crates.io-index" 44 | checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" 45 | 46 | [[package]] 47 | name = "bytes" 48 | version = "1.0.1" 49 | source = "registry+https://github.com/rust-lang/crates.io-index" 50 | checksum = "b700ce4376041dcd0a327fd0097c41095743c4c8af8887265942faf1100bd040" 51 | 52 | [[package]] 53 | name = "cfg-if" 54 | version = "1.0.0" 55 | source = "registry+https://github.com/rust-lang/crates.io-index" 56 | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" 57 | 58 | [[package]] 59 | name = "cpuid-bool" 60 | version = "0.1.2" 61 | source = "registry+https://github.com/rust-lang/crates.io-index" 62 | checksum = "8aebca1129a03dc6dc2b127edd729435bbc4a37e1d5f4d7513165089ceb02634" 63 | 64 | [[package]] 65 | name = "digest" 66 | version = "0.9.0" 67 | source = "registry+https://github.com/rust-lang/crates.io-index" 68 | checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" 69 | dependencies = [ 70 | "generic-array", 71 | ] 72 | 73 | [[package]] 74 | name = "fnv" 75 | version = "1.0.7" 76 | source = "registry+https://github.com/rust-lang/crates.io-index" 77 | checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" 78 | 79 | [[package]] 80 | name = "form_urlencoded" 81 | version = "1.0.1" 82 | source = "registry+https://github.com/rust-lang/crates.io-index" 83 | checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191" 84 | dependencies = [ 85 | "matches", 86 | "percent-encoding", 87 | ] 88 | 89 | [[package]] 90 | name = "futures" 91 | version = "0.3.13" 92 | source = "registry+https://github.com/rust-lang/crates.io-index" 93 | checksum = "7f55667319111d593ba876406af7c409c0ebb44dc4be6132a783ccf163ea14c1" 94 | dependencies = [ 95 | "futures-channel", 96 | "futures-core", 97 | "futures-io", 98 | "futures-sink", 99 | "futures-task", 100 | "futures-util", 101 | ] 102 | 103 | [[package]] 104 | name = "futures-channel" 105 | version = "0.3.13" 106 | source = "registry+https://github.com/rust-lang/crates.io-index" 107 | checksum = "8c2dd2df839b57db9ab69c2c9d8f3e8c81984781937fe2807dc6dcf3b2ad2939" 108 | dependencies = [ 109 | "futures-core", 110 | "futures-sink", 111 | ] 112 | 113 | [[package]] 114 | name = "futures-core" 115 | version = "0.3.13" 116 | source = "registry+https://github.com/rust-lang/crates.io-index" 117 | checksum = "15496a72fabf0e62bdc3df11a59a3787429221dd0710ba8ef163d6f7a9112c94" 118 | 119 | [[package]] 120 | name = "futures-io" 121 | version = "0.3.13" 122 | source = "registry+https://github.com/rust-lang/crates.io-index" 123 | checksum = "d71c2c65c57704c32f5241c1223167c2c3294fd34ac020c807ddbe6db287ba59" 124 | 125 | [[package]] 126 | name = "futures-sink" 127 | version = "0.3.13" 128 | source = "registry+https://github.com/rust-lang/crates.io-index" 129 | checksum = "85754d98985841b7d4f5e8e6fbfa4a4ac847916893ec511a2917ccd8525b8bb3" 130 | 131 | [[package]] 132 | name = "futures-task" 133 | version = "0.3.13" 134 | source = "registry+https://github.com/rust-lang/crates.io-index" 135 | checksum = "fa189ef211c15ee602667a6fcfe1c1fd9e07d42250d2156382820fba33c9df80" 136 | 137 | [[package]] 138 | name = "futures-util" 139 | version = "0.3.13" 140 | source = "registry+https://github.com/rust-lang/crates.io-index" 141 | checksum = "1812c7ab8aedf8d6f2701a43e1243acdbcc2b36ab26e2ad421eb99ac963d96d1" 142 | dependencies = [ 143 | "futures-core", 144 | "futures-sink", 145 | "futures-task", 146 | "pin-project-lite", 147 | "pin-utils", 148 | "slab", 149 | ] 150 | 151 | [[package]] 152 | name = "generic-array" 153 | version = "0.14.4" 154 | source = "registry+https://github.com/rust-lang/crates.io-index" 155 | checksum = "501466ecc8a30d1d3b7fc9229b122b2ce8ed6e9d9223f1138d4babb253e51817" 156 | dependencies = [ 157 | "typenum", 158 | "version_check", 159 | ] 160 | 161 | [[package]] 162 | name = "getrandom" 163 | version = "0.1.16" 164 | source = "registry+https://github.com/rust-lang/crates.io-index" 165 | checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" 166 | dependencies = [ 167 | "cfg-if", 168 | "libc", 169 | "wasi 0.9.0+wasi-snapshot-preview1", 170 | ] 171 | 172 | [[package]] 173 | name = "getrandom" 174 | version = "0.2.2" 175 | source = "registry+https://github.com/rust-lang/crates.io-index" 176 | checksum = "c9495705279e7140bf035dde1f6e750c162df8b625267cd52cc44e0b156732c8" 177 | dependencies = [ 178 | "cfg-if", 179 | "libc", 180 | "wasi 0.10.2+wasi-snapshot-preview1", 181 | ] 182 | 183 | [[package]] 184 | name = "h2" 185 | version = "0.3.2" 186 | source = "registry+https://github.com/rust-lang/crates.io-index" 187 | checksum = "fc018e188373e2777d0ef2467ebff62a08e66c3f5857b23c8fbec3018210dc00" 188 | dependencies = [ 189 | "bytes", 190 | "fnv", 191 | "futures-core", 192 | "futures-sink", 193 | "futures-util", 194 | "http", 195 | "indexmap", 196 | "slab", 197 | "tokio", 198 | "tokio-util", 199 | "tracing", 200 | ] 201 | 202 | [[package]] 203 | name = "hashbrown" 204 | version = "0.9.1" 205 | source = "registry+https://github.com/rust-lang/crates.io-index" 206 | checksum = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04" 207 | 208 | [[package]] 209 | name = "headers" 210 | version = "0.3.4" 211 | source = "registry+https://github.com/rust-lang/crates.io-index" 212 | checksum = "f0b7591fb62902706ae8e7aaff416b1b0fa2c0fd0878b46dc13baa3712d8a855" 213 | dependencies = [ 214 | "base64", 215 | "bitflags", 216 | "bytes", 217 | "headers-core", 218 | "http", 219 | "mime", 220 | "sha-1", 221 | "time", 222 | ] 223 | 224 | [[package]] 225 | name = "headers-core" 226 | version = "0.2.0" 227 | source = "registry+https://github.com/rust-lang/crates.io-index" 228 | checksum = "e7f66481bfee273957b1f20485a4ff3362987f85b2c236580d81b4eb7a326429" 229 | dependencies = [ 230 | "http", 231 | ] 232 | 233 | [[package]] 234 | name = "hello" 235 | version = "0.1.0" 236 | dependencies = [ 237 | "tokio", 238 | "warp", 239 | ] 240 | 241 | [[package]] 242 | name = "hermit-abi" 243 | version = "0.1.18" 244 | source = "registry+https://github.com/rust-lang/crates.io-index" 245 | checksum = "322f4de77956e22ed0e5032c359a0f1273f1f7f0d79bfa3b8ffbc730d7fbcc5c" 246 | dependencies = [ 247 | "libc", 248 | ] 249 | 250 | [[package]] 251 | name = "http" 252 | version = "0.2.3" 253 | source = "registry+https://github.com/rust-lang/crates.io-index" 254 | checksum = "7245cd7449cc792608c3c8a9eaf69bd4eabbabf802713748fd739c98b82f0747" 255 | dependencies = [ 256 | "bytes", 257 | "fnv", 258 | "itoa", 259 | ] 260 | 261 | [[package]] 262 | name = "http-body" 263 | version = "0.4.1" 264 | source = "registry+https://github.com/rust-lang/crates.io-index" 265 | checksum = "5dfb77c123b4e2f72a2069aeae0b4b4949cc7e966df277813fc16347e7549737" 266 | dependencies = [ 267 | "bytes", 268 | "http", 269 | "pin-project-lite", 270 | ] 271 | 272 | [[package]] 273 | name = "httparse" 274 | version = "1.3.5" 275 | source = "registry+https://github.com/rust-lang/crates.io-index" 276 | checksum = "615caabe2c3160b313d52ccc905335f4ed5f10881dd63dc5699d47e90be85691" 277 | 278 | [[package]] 279 | name = "httpdate" 280 | version = "0.3.2" 281 | source = "registry+https://github.com/rust-lang/crates.io-index" 282 | checksum = "494b4d60369511e7dea41cf646832512a94e542f68bb9c49e54518e0f468eb47" 283 | 284 | [[package]] 285 | name = "hyper" 286 | version = "0.14.5" 287 | source = "registry+https://github.com/rust-lang/crates.io-index" 288 | checksum = "8bf09f61b52cfcf4c00de50df88ae423d6c02354e385a86341133b5338630ad1" 289 | dependencies = [ 290 | "bytes", 291 | "futures-channel", 292 | "futures-core", 293 | "futures-util", 294 | "h2", 295 | "http", 296 | "http-body", 297 | "httparse", 298 | "httpdate", 299 | "itoa", 300 | "pin-project", 301 | "socket2", 302 | "tokio", 303 | "tower-service", 304 | "tracing", 305 | "want", 306 | ] 307 | 308 | [[package]] 309 | name = "idna" 310 | version = "0.2.2" 311 | source = "registry+https://github.com/rust-lang/crates.io-index" 312 | checksum = "89829a5d69c23d348314a7ac337fe39173b61149a9864deabd260983aed48c21" 313 | dependencies = [ 314 | "matches", 315 | "unicode-bidi", 316 | "unicode-normalization", 317 | ] 318 | 319 | [[package]] 320 | name = "indexmap" 321 | version = "1.6.2" 322 | source = "registry+https://github.com/rust-lang/crates.io-index" 323 | checksum = "824845a0bf897a9042383849b02c1bc219c2383772efcd5c6f9766fa4b81aef3" 324 | dependencies = [ 325 | "autocfg", 326 | "hashbrown", 327 | ] 328 | 329 | [[package]] 330 | name = "input_buffer" 331 | version = "0.4.0" 332 | source = "registry+https://github.com/rust-lang/crates.io-index" 333 | checksum = "f97967975f448f1a7ddb12b0bc41069d09ed6a1c161a92687e057325db35d413" 334 | dependencies = [ 335 | "bytes", 336 | ] 337 | 338 | [[package]] 339 | name = "instant" 340 | version = "0.1.9" 341 | source = "registry+https://github.com/rust-lang/crates.io-index" 342 | checksum = "61124eeebbd69b8190558df225adf7e4caafce0d743919e5d6b19652314ec5ec" 343 | dependencies = [ 344 | "cfg-if", 345 | ] 346 | 347 | [[package]] 348 | name = "itoa" 349 | version = "0.4.7" 350 | source = "registry+https://github.com/rust-lang/crates.io-index" 351 | checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" 352 | 353 | [[package]] 354 | name = "lazy_static" 355 | version = "1.4.0" 356 | source = "registry+https://github.com/rust-lang/crates.io-index" 357 | checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" 358 | 359 | [[package]] 360 | name = "libc" 361 | version = "0.2.92" 362 | source = "registry+https://github.com/rust-lang/crates.io-index" 363 | checksum = "56d855069fafbb9b344c0f962150cd2c1187975cb1c22c1522c240d8c4986714" 364 | 365 | [[package]] 366 | name = "lock_api" 367 | version = "0.4.3" 368 | source = "registry+https://github.com/rust-lang/crates.io-index" 369 | checksum = "5a3c91c24eae6777794bb1997ad98bbb87daf92890acab859f7eaa4320333176" 370 | dependencies = [ 371 | "scopeguard", 372 | ] 373 | 374 | [[package]] 375 | name = "log" 376 | version = "0.4.14" 377 | source = "registry+https://github.com/rust-lang/crates.io-index" 378 | checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" 379 | dependencies = [ 380 | "cfg-if", 381 | ] 382 | 383 | [[package]] 384 | name = "matches" 385 | version = "0.1.8" 386 | source = "registry+https://github.com/rust-lang/crates.io-index" 387 | checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" 388 | 389 | [[package]] 390 | name = "memchr" 391 | version = "2.3.4" 392 | source = "registry+https://github.com/rust-lang/crates.io-index" 393 | checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" 394 | 395 | [[package]] 396 | name = "mime" 397 | version = "0.3.16" 398 | source = "registry+https://github.com/rust-lang/crates.io-index" 399 | checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" 400 | 401 | [[package]] 402 | name = "mime_guess" 403 | version = "2.0.3" 404 | source = "registry+https://github.com/rust-lang/crates.io-index" 405 | checksum = "2684d4c2e97d99848d30b324b00c8fcc7e5c897b7cbb5819b09e7c90e8baf212" 406 | dependencies = [ 407 | "mime", 408 | "unicase", 409 | ] 410 | 411 | [[package]] 412 | name = "mio" 413 | version = "0.7.11" 414 | source = "registry+https://github.com/rust-lang/crates.io-index" 415 | checksum = "cf80d3e903b34e0bd7282b218398aec54e082c840d9baf8339e0080a0c542956" 416 | dependencies = [ 417 | "libc", 418 | "log", 419 | "miow", 420 | "ntapi", 421 | "winapi", 422 | ] 423 | 424 | [[package]] 425 | name = "miow" 426 | version = "0.3.7" 427 | source = "registry+https://github.com/rust-lang/crates.io-index" 428 | checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21" 429 | dependencies = [ 430 | "winapi", 431 | ] 432 | 433 | [[package]] 434 | name = "multipart" 435 | version = "0.17.1" 436 | source = "registry+https://github.com/rust-lang/crates.io-index" 437 | checksum = "d050aeedc89243f5347c3e237e3e13dc76fbe4ae3742a57b94dc14f69acf76d4" 438 | dependencies = [ 439 | "buf_redux", 440 | "httparse", 441 | "log", 442 | "mime", 443 | "mime_guess", 444 | "quick-error", 445 | "rand 0.7.3", 446 | "safemem", 447 | "tempfile", 448 | "twoway", 449 | ] 450 | 451 | [[package]] 452 | name = "ntapi" 453 | version = "0.3.6" 454 | source = "registry+https://github.com/rust-lang/crates.io-index" 455 | checksum = "3f6bb902e437b6d86e03cce10a7e2af662292c5dfef23b65899ea3ac9354ad44" 456 | dependencies = [ 457 | "winapi", 458 | ] 459 | 460 | [[package]] 461 | name = "num_cpus" 462 | version = "1.13.0" 463 | source = "registry+https://github.com/rust-lang/crates.io-index" 464 | checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" 465 | dependencies = [ 466 | "hermit-abi", 467 | "libc", 468 | ] 469 | 470 | [[package]] 471 | name = "once_cell" 472 | version = "1.7.2" 473 | source = "registry+https://github.com/rust-lang/crates.io-index" 474 | checksum = "af8b08b04175473088b46763e51ee54da5f9a164bc162f615b91bc179dbf15a3" 475 | 476 | [[package]] 477 | name = "opaque-debug" 478 | version = "0.3.0" 479 | source = "registry+https://github.com/rust-lang/crates.io-index" 480 | checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" 481 | 482 | [[package]] 483 | name = "parking_lot" 484 | version = "0.11.1" 485 | source = "registry+https://github.com/rust-lang/crates.io-index" 486 | checksum = "6d7744ac029df22dca6284efe4e898991d28e3085c706c972bcd7da4a27a15eb" 487 | dependencies = [ 488 | "instant", 489 | "lock_api", 490 | "parking_lot_core", 491 | ] 492 | 493 | [[package]] 494 | name = "parking_lot_core" 495 | version = "0.8.3" 496 | source = "registry+https://github.com/rust-lang/crates.io-index" 497 | checksum = "fa7a782938e745763fe6907fc6ba86946d72f49fe7e21de074e08128a99fb018" 498 | dependencies = [ 499 | "cfg-if", 500 | "instant", 501 | "libc", 502 | "redox_syscall", 503 | "smallvec", 504 | "winapi", 505 | ] 506 | 507 | [[package]] 508 | name = "percent-encoding" 509 | version = "2.1.0" 510 | source = "registry+https://github.com/rust-lang/crates.io-index" 511 | checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" 512 | 513 | [[package]] 514 | name = "pin-project" 515 | version = "1.0.6" 516 | source = "registry+https://github.com/rust-lang/crates.io-index" 517 | checksum = "bc174859768806e91ae575187ada95c91a29e96a98dc5d2cd9a1fed039501ba6" 518 | dependencies = [ 519 | "pin-project-internal", 520 | ] 521 | 522 | [[package]] 523 | name = "pin-project-internal" 524 | version = "1.0.6" 525 | source = "registry+https://github.com/rust-lang/crates.io-index" 526 | checksum = "a490329918e856ed1b083f244e3bfe2d8c4f336407e4ea9e1a9f479ff09049e5" 527 | dependencies = [ 528 | "proc-macro2", 529 | "quote", 530 | "syn", 531 | ] 532 | 533 | [[package]] 534 | name = "pin-project-lite" 535 | version = "0.2.6" 536 | source = "registry+https://github.com/rust-lang/crates.io-index" 537 | checksum = "dc0e1f259c92177c30a4c9d177246edd0a3568b25756a977d0632cf8fa37e905" 538 | 539 | [[package]] 540 | name = "pin-utils" 541 | version = "0.1.0" 542 | source = "registry+https://github.com/rust-lang/crates.io-index" 543 | checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" 544 | 545 | [[package]] 546 | name = "ppv-lite86" 547 | version = "0.2.10" 548 | source = "registry+https://github.com/rust-lang/crates.io-index" 549 | checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" 550 | 551 | [[package]] 552 | name = "proc-macro2" 553 | version = "1.0.26" 554 | source = "registry+https://github.com/rust-lang/crates.io-index" 555 | checksum = "a152013215dca273577e18d2bf00fa862b89b24169fb78c4c95aeb07992c9cec" 556 | dependencies = [ 557 | "unicode-xid", 558 | ] 559 | 560 | [[package]] 561 | name = "quick-error" 562 | version = "1.2.3" 563 | source = "registry+https://github.com/rust-lang/crates.io-index" 564 | checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" 565 | 566 | [[package]] 567 | name = "quote" 568 | version = "1.0.9" 569 | source = "registry+https://github.com/rust-lang/crates.io-index" 570 | checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7" 571 | dependencies = [ 572 | "proc-macro2", 573 | ] 574 | 575 | [[package]] 576 | name = "rand" 577 | version = "0.7.3" 578 | source = "registry+https://github.com/rust-lang/crates.io-index" 579 | checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" 580 | dependencies = [ 581 | "getrandom 0.1.16", 582 | "libc", 583 | "rand_chacha 0.2.2", 584 | "rand_core 0.5.1", 585 | "rand_hc 0.2.0", 586 | ] 587 | 588 | [[package]] 589 | name = "rand" 590 | version = "0.8.3" 591 | source = "registry+https://github.com/rust-lang/crates.io-index" 592 | checksum = "0ef9e7e66b4468674bfcb0c81af8b7fa0bb154fa9f28eb840da5c447baeb8d7e" 593 | dependencies = [ 594 | "libc", 595 | "rand_chacha 0.3.0", 596 | "rand_core 0.6.2", 597 | "rand_hc 0.3.0", 598 | ] 599 | 600 | [[package]] 601 | name = "rand_chacha" 602 | version = "0.2.2" 603 | source = "registry+https://github.com/rust-lang/crates.io-index" 604 | checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" 605 | dependencies = [ 606 | "ppv-lite86", 607 | "rand_core 0.5.1", 608 | ] 609 | 610 | [[package]] 611 | name = "rand_chacha" 612 | version = "0.3.0" 613 | source = "registry+https://github.com/rust-lang/crates.io-index" 614 | checksum = "e12735cf05c9e10bf21534da50a147b924d555dc7a547c42e6bb2d5b6017ae0d" 615 | dependencies = [ 616 | "ppv-lite86", 617 | "rand_core 0.6.2", 618 | ] 619 | 620 | [[package]] 621 | name = "rand_core" 622 | version = "0.5.1" 623 | source = "registry+https://github.com/rust-lang/crates.io-index" 624 | checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" 625 | dependencies = [ 626 | "getrandom 0.1.16", 627 | ] 628 | 629 | [[package]] 630 | name = "rand_core" 631 | version = "0.6.2" 632 | source = "registry+https://github.com/rust-lang/crates.io-index" 633 | checksum = "34cf66eb183df1c5876e2dcf6b13d57340741e8dc255b48e40a26de954d06ae7" 634 | dependencies = [ 635 | "getrandom 0.2.2", 636 | ] 637 | 638 | [[package]] 639 | name = "rand_hc" 640 | version = "0.2.0" 641 | source = "registry+https://github.com/rust-lang/crates.io-index" 642 | checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" 643 | dependencies = [ 644 | "rand_core 0.5.1", 645 | ] 646 | 647 | [[package]] 648 | name = "rand_hc" 649 | version = "0.3.0" 650 | source = "registry+https://github.com/rust-lang/crates.io-index" 651 | checksum = "3190ef7066a446f2e7f42e239d161e905420ccab01eb967c9eb27d21b2322a73" 652 | dependencies = [ 653 | "rand_core 0.6.2", 654 | ] 655 | 656 | [[package]] 657 | name = "redox_syscall" 658 | version = "0.2.5" 659 | source = "registry+https://github.com/rust-lang/crates.io-index" 660 | checksum = "94341e4e44e24f6b591b59e47a8a027df12e008d73fd5672dbea9cc22f4507d9" 661 | dependencies = [ 662 | "bitflags", 663 | ] 664 | 665 | [[package]] 666 | name = "remove_dir_all" 667 | version = "0.5.3" 668 | source = "registry+https://github.com/rust-lang/crates.io-index" 669 | checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" 670 | dependencies = [ 671 | "winapi", 672 | ] 673 | 674 | [[package]] 675 | name = "ryu" 676 | version = "1.0.5" 677 | source = "registry+https://github.com/rust-lang/crates.io-index" 678 | checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" 679 | 680 | [[package]] 681 | name = "safemem" 682 | version = "0.3.3" 683 | source = "registry+https://github.com/rust-lang/crates.io-index" 684 | checksum = "ef703b7cb59335eae2eb93ceb664c0eb7ea6bf567079d843e09420219668e072" 685 | 686 | [[package]] 687 | name = "scoped-tls" 688 | version = "1.0.0" 689 | source = "registry+https://github.com/rust-lang/crates.io-index" 690 | checksum = "ea6a9290e3c9cf0f18145ef7ffa62d68ee0bf5fcd651017e586dc7fd5da448c2" 691 | 692 | [[package]] 693 | name = "scopeguard" 694 | version = "1.1.0" 695 | source = "registry+https://github.com/rust-lang/crates.io-index" 696 | checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" 697 | 698 | [[package]] 699 | name = "serde" 700 | version = "1.0.125" 701 | source = "registry+https://github.com/rust-lang/crates.io-index" 702 | checksum = "558dc50e1a5a5fa7112ca2ce4effcb321b0300c0d4ccf0776a9f60cd89031171" 703 | 704 | [[package]] 705 | name = "serde_json" 706 | version = "1.0.64" 707 | source = "registry+https://github.com/rust-lang/crates.io-index" 708 | checksum = "799e97dc9fdae36a5c8b8f2cae9ce2ee9fdce2058c57a93e6099d919fd982f79" 709 | dependencies = [ 710 | "itoa", 711 | "ryu", 712 | "serde", 713 | ] 714 | 715 | [[package]] 716 | name = "serde_urlencoded" 717 | version = "0.7.0" 718 | source = "registry+https://github.com/rust-lang/crates.io-index" 719 | checksum = "edfa57a7f8d9c1d260a549e7224100f6c43d43f9103e06dd8b4095a9b2b43ce9" 720 | dependencies = [ 721 | "form_urlencoded", 722 | "itoa", 723 | "ryu", 724 | "serde", 725 | ] 726 | 727 | [[package]] 728 | name = "sha-1" 729 | version = "0.9.4" 730 | source = "registry+https://github.com/rust-lang/crates.io-index" 731 | checksum = "dfebf75d25bd900fd1e7d11501efab59bc846dbc76196839663e6637bba9f25f" 732 | dependencies = [ 733 | "block-buffer", 734 | "cfg-if", 735 | "cpuid-bool", 736 | "digest", 737 | "opaque-debug", 738 | ] 739 | 740 | [[package]] 741 | name = "signal-hook-registry" 742 | version = "1.3.0" 743 | source = "registry+https://github.com/rust-lang/crates.io-index" 744 | checksum = "16f1d0fef1604ba8f7a073c7e701f213e056707210e9020af4528e0101ce11a6" 745 | dependencies = [ 746 | "libc", 747 | ] 748 | 749 | [[package]] 750 | name = "slab" 751 | version = "0.4.2" 752 | source = "registry+https://github.com/rust-lang/crates.io-index" 753 | checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" 754 | 755 | [[package]] 756 | name = "smallvec" 757 | version = "1.6.1" 758 | source = "registry+https://github.com/rust-lang/crates.io-index" 759 | checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e" 760 | 761 | [[package]] 762 | name = "socket2" 763 | version = "0.4.0" 764 | source = "registry+https://github.com/rust-lang/crates.io-index" 765 | checksum = "9e3dfc207c526015c632472a77be09cf1b6e46866581aecae5cc38fb4235dea2" 766 | dependencies = [ 767 | "libc", 768 | "winapi", 769 | ] 770 | 771 | [[package]] 772 | name = "syn" 773 | version = "1.0.68" 774 | source = "registry+https://github.com/rust-lang/crates.io-index" 775 | checksum = "3ce15dd3ed8aa2f8eeac4716d6ef5ab58b6b9256db41d7e1a0224c2788e8fd87" 776 | dependencies = [ 777 | "proc-macro2", 778 | "quote", 779 | "unicode-xid", 780 | ] 781 | 782 | [[package]] 783 | name = "tempfile" 784 | version = "3.2.0" 785 | source = "registry+https://github.com/rust-lang/crates.io-index" 786 | checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22" 787 | dependencies = [ 788 | "cfg-if", 789 | "libc", 790 | "rand 0.8.3", 791 | "redox_syscall", 792 | "remove_dir_all", 793 | "winapi", 794 | ] 795 | 796 | [[package]] 797 | name = "time" 798 | version = "0.1.43" 799 | source = "registry+https://github.com/rust-lang/crates.io-index" 800 | checksum = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438" 801 | dependencies = [ 802 | "libc", 803 | "winapi", 804 | ] 805 | 806 | [[package]] 807 | name = "tinyvec" 808 | version = "1.2.0" 809 | source = "registry+https://github.com/rust-lang/crates.io-index" 810 | checksum = "5b5220f05bb7de7f3f53c7c065e1199b3172696fe2db9f9c4d8ad9b4ee74c342" 811 | dependencies = [ 812 | "tinyvec_macros", 813 | ] 814 | 815 | [[package]] 816 | name = "tinyvec_macros" 817 | version = "0.1.0" 818 | source = "registry+https://github.com/rust-lang/crates.io-index" 819 | checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" 820 | 821 | [[package]] 822 | name = "tokio" 823 | version = "1.4.0" 824 | source = "registry+https://github.com/rust-lang/crates.io-index" 825 | checksum = "134af885d758d645f0f0505c9a8b3f9bf8a348fd822e112ab5248138348f1722" 826 | dependencies = [ 827 | "autocfg", 828 | "bytes", 829 | "libc", 830 | "memchr", 831 | "mio", 832 | "num_cpus", 833 | "once_cell", 834 | "parking_lot", 835 | "pin-project-lite", 836 | "signal-hook-registry", 837 | "tokio-macros", 838 | "winapi", 839 | ] 840 | 841 | [[package]] 842 | name = "tokio-macros" 843 | version = "1.1.0" 844 | source = "registry+https://github.com/rust-lang/crates.io-index" 845 | checksum = "caf7b11a536f46a809a8a9f0bb4237020f70ecbf115b842360afb127ea2fda57" 846 | dependencies = [ 847 | "proc-macro2", 848 | "quote", 849 | "syn", 850 | ] 851 | 852 | [[package]] 853 | name = "tokio-stream" 854 | version = "0.1.5" 855 | source = "registry+https://github.com/rust-lang/crates.io-index" 856 | checksum = "e177a5d8c3bf36de9ebe6d58537d8879e964332f93fb3339e43f618c81361af0" 857 | dependencies = [ 858 | "futures-core", 859 | "pin-project-lite", 860 | "tokio", 861 | ] 862 | 863 | [[package]] 864 | name = "tokio-tungstenite" 865 | version = "0.13.0" 866 | source = "registry+https://github.com/rust-lang/crates.io-index" 867 | checksum = "e1a5f475f1b9d077ea1017ecbc60890fda8e54942d680ca0b1d2b47cfa2d861b" 868 | dependencies = [ 869 | "futures-util", 870 | "log", 871 | "pin-project", 872 | "tokio", 873 | "tungstenite", 874 | ] 875 | 876 | [[package]] 877 | name = "tokio-util" 878 | version = "0.6.5" 879 | source = "registry+https://github.com/rust-lang/crates.io-index" 880 | checksum = "5143d049e85af7fbc36f5454d990e62c2df705b3589f123b71f441b6b59f443f" 881 | dependencies = [ 882 | "bytes", 883 | "futures-core", 884 | "futures-sink", 885 | "log", 886 | "pin-project-lite", 887 | "tokio", 888 | ] 889 | 890 | [[package]] 891 | name = "tower-service" 892 | version = "0.3.1" 893 | source = "registry+https://github.com/rust-lang/crates.io-index" 894 | checksum = "360dfd1d6d30e05fda32ace2c8c70e9c0a9da713275777f5a4dbb8a1893930c6" 895 | 896 | [[package]] 897 | name = "tracing" 898 | version = "0.1.25" 899 | source = "registry+https://github.com/rust-lang/crates.io-index" 900 | checksum = "01ebdc2bb4498ab1ab5f5b73c5803825e60199229ccba0698170e3be0e7f959f" 901 | dependencies = [ 902 | "cfg-if", 903 | "log", 904 | "pin-project-lite", 905 | "tracing-core", 906 | ] 907 | 908 | [[package]] 909 | name = "tracing-core" 910 | version = "0.1.17" 911 | source = "registry+https://github.com/rust-lang/crates.io-index" 912 | checksum = "f50de3927f93d202783f4513cda820ab47ef17f624b03c096e86ef00c67e6b5f" 913 | dependencies = [ 914 | "lazy_static", 915 | ] 916 | 917 | [[package]] 918 | name = "try-lock" 919 | version = "0.2.3" 920 | source = "registry+https://github.com/rust-lang/crates.io-index" 921 | checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" 922 | 923 | [[package]] 924 | name = "tungstenite" 925 | version = "0.12.0" 926 | source = "registry+https://github.com/rust-lang/crates.io-index" 927 | checksum = "8ada8297e8d70872fa9a551d93250a9f407beb9f37ef86494eb20012a2ff7c24" 928 | dependencies = [ 929 | "base64", 930 | "byteorder", 931 | "bytes", 932 | "http", 933 | "httparse", 934 | "input_buffer", 935 | "log", 936 | "rand 0.8.3", 937 | "sha-1", 938 | "url", 939 | "utf-8", 940 | ] 941 | 942 | [[package]] 943 | name = "twoway" 944 | version = "0.1.8" 945 | source = "registry+https://github.com/rust-lang/crates.io-index" 946 | checksum = "59b11b2b5241ba34be09c3cc85a36e56e48f9888862e19cedf23336d35316ed1" 947 | dependencies = [ 948 | "memchr", 949 | ] 950 | 951 | [[package]] 952 | name = "typenum" 953 | version = "1.13.0" 954 | source = "registry+https://github.com/rust-lang/crates.io-index" 955 | checksum = "879f6906492a7cd215bfa4cf595b600146ccfac0c79bcbd1f3000162af5e8b06" 956 | 957 | [[package]] 958 | name = "unicase" 959 | version = "2.6.0" 960 | source = "registry+https://github.com/rust-lang/crates.io-index" 961 | checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6" 962 | dependencies = [ 963 | "version_check", 964 | ] 965 | 966 | [[package]] 967 | name = "unicode-bidi" 968 | version = "0.3.5" 969 | source = "registry+https://github.com/rust-lang/crates.io-index" 970 | checksum = "eeb8be209bb1c96b7c177c7420d26e04eccacb0eeae6b980e35fcb74678107e0" 971 | dependencies = [ 972 | "matches", 973 | ] 974 | 975 | [[package]] 976 | name = "unicode-normalization" 977 | version = "0.1.17" 978 | source = "registry+https://github.com/rust-lang/crates.io-index" 979 | checksum = "07fbfce1c8a97d547e8b5334978438d9d6ec8c20e38f56d4a4374d181493eaef" 980 | dependencies = [ 981 | "tinyvec", 982 | ] 983 | 984 | [[package]] 985 | name = "unicode-xid" 986 | version = "0.2.1" 987 | source = "registry+https://github.com/rust-lang/crates.io-index" 988 | checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" 989 | 990 | [[package]] 991 | name = "url" 992 | version = "2.2.1" 993 | source = "registry+https://github.com/rust-lang/crates.io-index" 994 | checksum = "9ccd964113622c8e9322cfac19eb1004a07e636c545f325da085d5cdde6f1f8b" 995 | dependencies = [ 996 | "form_urlencoded", 997 | "idna", 998 | "matches", 999 | "percent-encoding", 1000 | ] 1001 | 1002 | [[package]] 1003 | name = "utf-8" 1004 | version = "0.7.5" 1005 | source = "registry+https://github.com/rust-lang/crates.io-index" 1006 | checksum = "05e42f7c18b8f902290b009cde6d651262f956c98bc51bca4cd1d511c9cd85c7" 1007 | 1008 | [[package]] 1009 | name = "version_check" 1010 | version = "0.9.3" 1011 | source = "registry+https://github.com/rust-lang/crates.io-index" 1012 | checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe" 1013 | 1014 | [[package]] 1015 | name = "want" 1016 | version = "0.3.0" 1017 | source = "registry+https://github.com/rust-lang/crates.io-index" 1018 | checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" 1019 | dependencies = [ 1020 | "log", 1021 | "try-lock", 1022 | ] 1023 | 1024 | [[package]] 1025 | name = "warp" 1026 | version = "0.3.1" 1027 | source = "registry+https://github.com/rust-lang/crates.io-index" 1028 | checksum = "332d47745e9a0c38636dbd454729b147d16bd1ed08ae67b3ab281c4506771054" 1029 | dependencies = [ 1030 | "bytes", 1031 | "futures", 1032 | "headers", 1033 | "http", 1034 | "hyper", 1035 | "log", 1036 | "mime", 1037 | "mime_guess", 1038 | "multipart", 1039 | "percent-encoding", 1040 | "pin-project", 1041 | "scoped-tls", 1042 | "serde", 1043 | "serde_json", 1044 | "serde_urlencoded", 1045 | "tokio", 1046 | "tokio-stream", 1047 | "tokio-tungstenite", 1048 | "tokio-util", 1049 | "tower-service", 1050 | "tracing", 1051 | ] 1052 | 1053 | [[package]] 1054 | name = "wasi" 1055 | version = "0.9.0+wasi-snapshot-preview1" 1056 | source = "registry+https://github.com/rust-lang/crates.io-index" 1057 | checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" 1058 | 1059 | [[package]] 1060 | name = "wasi" 1061 | version = "0.10.2+wasi-snapshot-preview1" 1062 | source = "registry+https://github.com/rust-lang/crates.io-index" 1063 | checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" 1064 | 1065 | [[package]] 1066 | name = "winapi" 1067 | version = "0.3.9" 1068 | source = "registry+https://github.com/rust-lang/crates.io-index" 1069 | checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" 1070 | dependencies = [ 1071 | "winapi-i686-pc-windows-gnu", 1072 | "winapi-x86_64-pc-windows-gnu", 1073 | ] 1074 | 1075 | [[package]] 1076 | name = "winapi-i686-pc-windows-gnu" 1077 | version = "0.4.0" 1078 | source = "registry+https://github.com/rust-lang/crates.io-index" 1079 | checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 1080 | 1081 | [[package]] 1082 | name = "winapi-x86_64-pc-windows-gnu" 1083 | version = "0.4.0" 1084 | source = "registry+https://github.com/rust-lang/crates.io-index" 1085 | checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 1086 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "hello" 3 | version = "0.1.0" 4 | authors = ["Jerome Gravel-Niquet "] 5 | edition = "2018" 6 | 7 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 8 | 9 | [dependencies] 10 | tokio = { version = "1", features = ["full"] } 11 | warp = "0.3.1" 12 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM rust:1-bookworm as builder 2 | 3 | WORKDIR /usr/src/app 4 | COPY . . 5 | # Will build and cache the binary and dependent crates in release mode 6 | RUN --mount=type=cache,target=/usr/local/cargo,from=rust:latest,source=/usr/local/cargo \ 7 | --mount=type=cache,target=target \ 8 | cargo build --release && mv ./target/release/hello ./hello 9 | 10 | # Runtime image 11 | FROM debian:bookworm-slim 12 | 13 | # Run as "app" user 14 | RUN useradd -ms /bin/bash app 15 | 16 | USER app 17 | WORKDIR /app 18 | 19 | # Get compiled binaries from builder's cargo install directory 20 | COPY --from=builder /usr/src/app/hello /app/hello 21 | 22 | # Run the app 23 | CMD ./hello -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Hello Rust! 2 | 3 | This is an example app demonstrating how to deploy a Rust program on Fly.io 4 | 5 | ## Structure 6 | 7 | ### App 8 | 9 | Warp-based "hello world" app, as simple as it can get. 10 | 11 | #### Binding to all addresses 12 | 13 | Noticed this line? 14 | 15 | ```rust 16 | warp::serve(routes) 17 | // ipv6 + ipv6 any addr 18 | .run(([0, 0, 0, 0, 0, 0, 0, 0], 8080)) 19 | .await; 20 | ``` 21 | 22 | This listens to all addresses on both IPv4 and IPv6, on port 8080. It's important to do this because your app would otherwise need to know about the `172.19.0.0/16` IP it should bind to specifically. Binding to IPv6 is not required, but is likely a good idea going forward. 23 | 24 | ### fly.toml 25 | 26 | A fairly standard `fly.toml` configuration, except for the `cmd` override: 27 | 28 | ```toml 29 | [experimental] 30 | cmd = "./hello" # should be the name of the binary you want to run 31 | ``` 32 | 33 | ### Dockerfile 34 | 35 | The most efficient way to create a Docker image for a Rust app is a simple Dockerfile. 36 | 37 | Our `Dockerfile` is heavily commented, but here's a short rundown: 38 | - Copy `Cargo.{toml,lock}` and build dependencies 39 | - Copy whole project and `cargo install` it 40 | - 41 | 42 | #### .dockerignore 43 | 44 | You definitely want to ignore `/target` since this can get pretty hefty, adding to the build context's size, and slow down builds significantly. 45 | 46 | ## Deploy 47 | 48 | ``` 49 | fly launch 50 | ``` 51 | 52 | -------------------------------------------------------------------------------- /fly.toml: -------------------------------------------------------------------------------- 1 | # fly.toml file generated for holy-grass-8371 on 2021-04-06T14:31:33-04:00 2 | 3 | app = "hello-rust" 4 | 5 | kill_signal = "SIGINT" 6 | kill_timeout = 5 7 | 8 | [env] 9 | PORT = "8080" 10 | 11 | [[services]] 12 | internal_port = 8080 13 | protocol = "tcp" 14 | 15 | [services.concurrency] 16 | hard_limit = 25 17 | soft_limit = 20 18 | 19 | [[services.ports]] 20 | handlers = ["http"] 21 | port = "80" 22 | 23 | [[services.ports]] 24 | handlers = ["tls", "http"] 25 | port = "443" 26 | 27 | [[services.tcp_checks]] 28 | grace_period = "1s" 29 | interval = "15s" 30 | port = "8080" 31 | restart_limit = 6 32 | timeout = "2s" 33 | -------------------------------------------------------------------------------- /src/main.rs: -------------------------------------------------------------------------------- 1 | #![deny(warnings)] 2 | use warp::Filter; 3 | 4 | #[tokio::main] 5 | async fn main() { 6 | // Match any request and return hello world! 7 | let routes = warp::any().map(|| "Hello, World!"); 8 | 9 | warp::serve(routes) 10 | // ipv6 + ipv6 any addr 11 | .run(([0, 0, 0, 0, 0, 0, 0, 0], 8080)) 12 | .await; 13 | } 14 | --------------------------------------------------------------------------------