update readme and also fix bugs found during that

This commit is contained in:
xenia 2020-12-29 02:16:31 -05:00
parent 05b3e97a66
commit 556fd34b05
7 changed files with 139 additions and 13 deletions

View File

@ -18,7 +18,7 @@
.PHONY: all check clean dev-migrate dev-rollback
all:
raco setup ./crossfire/
raco pkg install ./crossfire
check:
raco check-requires -- crossfire/*.rkt

130
README.md
View File

@ -22,6 +22,122 @@ distributed brute force infrastructure
takes the difficulty out of creating custom brute force jobs
## getting started with the extremely basic but currently working MVP
`cd` to the repo directory. hopefully you're already here :P
add user-level racket dir to your PATH
```bash
export PATH=$HOME/.racket/$(racket -e "(displayln (version))")/bin:$PATH
```
install package from repo
```bash
raco pkg install ./crossfire
```
setup development environment
```bash
export DATABASE_URL="sqlite:lib/crossfire.sqlite"
mkdir -p lib/projects
```
initialize server with some temporary dev commands (this assumes your computer is x86_64 linux)
the arch corresponds to the output of `gcc -dumpmachine` for the target
```bash
crossfire-server dev-new-agent meow x86_64-pc-linux-gnu # exports lib/meow.rktd
crossfire-server dev-export-client # exports lib/client0.rktd
```
start the server and a development version of the agent (WIP) using the exported agent config
```bash
crossfire-server
# somewhere else
racket crossfire/agent.rkt -c lib/meow.rktd
```
set up the client with access to the server using the previous client config
```bash
crossfire-client setup lib/client0.rktd
```
create a new project
```bash
crossfire-client new meow2
cd meow2
```
edit config `manifest.rktd`
- change `(mode stdio)` to `(mode callback)` (stdio mode isn't working yet)
- change `(command ...)` to `(command "./meow")`
generate files (Makefile, crossfire.c, crossfire.h -- these are support code for running your code
on agents. in callback mode, your code registers a callback with crossfire that gets called for each
possible input, and returns true or false)
```
crossfire-client generate
```
create a new source file `meow.c` with the following
```c
#include "crossfire.h"
bool my_callback( vartype a,vartype b,vartype c,vartype d,vartype e,vartype f) {
return e == '4' && f == '2';
}
int main(int argc, char* argv[]) {
return crossfire_main(argc, argv, my_callback);
}
```
update the makefile
```make
.PHONY: all clean
CC=gcc
CFLAGS=-std=c11 -O3
LDFLAGS=-static
all: meow
meow: meow.o crossfire.o
clean:
$(RM) meow meow.o
# crossfire rules
### leave this section alone
```
build project
```bash
make
```
now we're ready to submit
```bash
crossfire-client submit
```
check status of projects
```bash
crossfire-client status
```
this one completes pretty fast, so you should see 100% progress and one match
let's show the match (assuming the project ID from the status command is `1`)
```bash
crossfire-client show 1
```
aaaaand yeah that's all for now. smp is not supported yet. stdio mode is also not supported yet.
lots of stuff still probably broken tbh
contributions welcome,,,,
## status
### base
@ -40,7 +156,7 @@ takes the difficulty out of creating custom brute force jobs
- 🚧 codegen for input generator (in C)
- ✅ stdio mode
- 🚧 callback mode
- success reporting mechanism
- success reporting mechanism
- low priority: configurable "character" type -- currently a "character" is a uint64\_t
### server: distribute jobs to workers
@ -70,14 +186,18 @@ takes the difficulty out of creating custom brute force jobs
### client: submit jobs and view progress
- ✅securely connect to server
- command line interface
- `crossfire new`: create new crossfire project
- ✅ `crossfire new`: create new crossfire project
- ✅ `crossfire generate`: updates autogenerated files in a project
- ✅ `crossfire check`: checks some common misconfiguration issues
- `crossfire test`: test project locally, replicates configuration of server with single local
agent to debug issues
- low priority: `crossfire node-test`: submit a mini-task to a node that has the necessary
resources to debug issues
- `crossfire submit`: submit task to server
- `crossfire cancel`: cancels submitted task
- `crossfire status`: check status of task (or network as a whole)
- ✅ `crossfire submit`: submit task to server
- ✅ `crossfire delete`: cancels/deletes submitted task
- ✅ `crossfire status`: check status of server / task summary
- ✅ `crossfire show`: shows task details
- ✅ `crossfire setup`: sets up access to a server
- low priority: gui interface (racket/gui & framework time)
## misc

View File

@ -91,7 +91,7 @@
(void))
(define (cmd-update project-dir)
(define (cmd-generate project-dir)
(define priv-cache (build-path project-dir *cf-private-cache*))
(define mf (parse-manifest (call-with-input-file (build-path project-dir "manifest.rktd") read)))
(define new-files (generate-support-code mf))
@ -227,8 +227,8 @@
(apply report-status msg args)
(exit 1))
(define (interactive-update)
(match (cmd-update (current-directory))
(define (interactive-generate)
(match (cmd-generate (current-directory))
['() (report-status "generated files are up-to-date")]
[(list msgs ...)
(for ([msg (in-list msgs)])
@ -285,9 +285,9 @@
(cmd-new project-name (string->symbol (flag-mode)))
(report-status "created new project ~a" project-name))
(subcommand (update "Update generated files in a project")
(subcommand (generate "Update generated files in a project")
#:args ()
(interactive-update))
(interactive-generate))
(subcommand (check "Check over a project for issues")
#:args ()
@ -326,6 +326,8 @@
(define config
(call-with-input-file config-file read))
(cmd-setup config)
(report-status "testing server connection")
(cmd-status)
(report-status "successfully imported config")))
(define (print-usage)

View File

@ -45,7 +45,7 @@
;; ok gamer move time
(define-runtime-path codegen-template "templates/codegen.rktc")
(define-runtime-path header-template "templates/header.rktc")
(define-runtime-path makefile-template "templates/Makefile.rkt")
(define-runtime-path makefile-template "templates/Makefile.rktmake")
(define-runtime-path manifest-template "templates/manifest.rktrktd")
;; TODO : make configurable

View File

@ -25,3 +25,6 @@
"north"))
(define build-deps '("scribble-lib" "racket-doc" "rackunit-lib"))
(define scribblings '(("scribblings/crossfire.scrbl" ())))
(define racket-launcher-names '("crossfire-server" "crossfire-client"))
(define racket-launcher-libraries '("server.rkt" "client.rkt"))

View File

@ -891,7 +891,8 @@
;; create client if it doesn't exist yet
(when (empty? (get-nodes 'client))
(log-server-info "creating new client")
(make-node "client0" "x-client" 'client '()))
(make-node "client0" "x-client" 'client '())
(void))
(define seckey (file->bytes *server-seckey-path*))
(define pubkey (crypto-sign-public-key seckey))