Let's Run Something

Let’s execute our first application!

    cd $GOPATH/src/jiffy_tests/first_app
    go run main.go -dev -rs

Executing with the -dev and -rs flags instructs our new application to initialize itself using the development configuration file, and forces a rebuild of the ‘Super’ authorization-group. Consequently, some warning and info messages will scroll up the screen which is expected.


    2018/02/05 22:29:26 package sqac init is running
    2018/02/05 22:29:26 successfully loaded the config file...
    2018/02/05 22:29:26 JWTPrivKeyFile: jwtkeys/private.pem
    2018/02/05 22:29:26 JWTPubKeyFile: jwtkeys/public.pem
    2018/02/05 22:29:26 warning: auth usr.GET_SET not found in the db Auth master data
    2018/02/05 22:29:26 warning: auth usr.CREATE not found in the db Auth master data
    2018/02/05 22:29:26 warning: auth usr.GET_ID not found in the db Auth master data
    ...
    ...
    2018/02/05 22:29:26 info: creating auth usr.GET_SET in the db Auth master data
    2018/02/05 22:29:26 warning: new auth usr.GET_SET must be added to at least one group
    2018/02/05 22:29:26 info: creating auth usr.CREATE in the db Auth master data
    2018/02/05 22:29:26 warning: new auth usr.CREATE must be added to at least one group
    ...
    ...
    2018/02/05 22:29:26 warning: new auth person.STATICFLTR_ByValidLicense must be added to at least one group
    2018/02/05 22:29:26 info: creating auth person.STATICFLTR_CMD_ByValidLicense in the db Auth master data
    2018/02/05 22:29:26 warning: new auth person.STATICFLTR_CMD_ByValidLicense must be added to at least one group
    2018/02/05 22:29:26 The Super UsrGroup has been initialized with 42 Auth objects.
    2018/02/05 22:29:26 re-initializing local middleware to accomodate Super group changes.
    2018/02/05 22:29:27 admin user created with ID: 1 and initial password of initpass
    Development settings selected...
    Starting http server on port...  8080
    

If all goes well, a message indicating that the application is running will be displayed. During the startup, the application executed a number of steps:

  1. Loaded the development configuration file.
  2. Initialized a handle to the underlying sqac ORM.
  3. Checked for and loaded the public and private keys for JWT support.
  4. Checked for and created the user, auth, and usrgroup tables in the database.
  5. Checked for and created the person table in the database based on the ‘Person’ model.
  6. Checked for and created authorizations in the database for each service end-point.
  7. Checked for and created the Super user-group in the database.
  8. Assigned all authorizations to the Super user-group.
  9. Created the ‘admin’ user and assigned it to the ‘Super’ user-group.
  10. Initialized the authorization, user, user-group and auth-groups caches in the router.
  11. Started the router.
  12. Looked at the leader-persistence store to determine the group-leader (running in standalone mode).
  13. Became the defacto group-leader, set own process-id (usually to 1 in this case).
  14. Updated the leader-persistence store with the new group-leader information.
  15. Started the inter-process failure-detector.

Congratulations! Your first application is now open for business at http://127.0.0.1:8080

Note that subsequent starts of the application should be done without the use of the -rs flag.

    cd $GOPATH/src/jiffy_tests/first_app
    go run main.go -dev