Skip to content
Snippets Groups Projects
README.md 1.91 KiB
Newer Older
  • Learn to ignore specific revisions
  • meskio's avatar
    meskio committed
    # Cicer
    
    Cicer is a web based software to manage the stock, purchases and balance of a consumer association. It has being created for the needs of the [Garbanzo Negro](http://garbanzonegro.org).
    
    
    meskio's avatar
    meskio committed
    - Golang >= 1.12
    - Node.js
    
    meskio's avatar
    meskio committed
    
    Build a copy using make:
    
    meskio's avatar
    meskio committed
    ```
    
    Create a secret for the authentication tokens:
    
    
    ```shell
    head -c 21 < /dev/urandom | base64
    
    meskio's avatar
    meskio committed
    ```
    
    Now you can copy the build folder and the cicer binary to your server and run it like:
    
    
    ```shell
    ./cicer -assets 'path/to/build' -secret 'scret' -addr ':8000'
    
    meskio's avatar
    meskio committed
    ```
    
    
    Instead of flags all the params can be passed as env variables. See the names between `{` and `}` in:
    
    meskio's avatar
    meskio committed
    
    
    meskio's avatar
    meskio committed
    ```
    
    
    ## Running it for development
    
    To run Cicer in development mode, build and run the backend:
    
    ```shell
    go build
    ./cicer
    
    meskio's avatar
    meskio committed
    ```
    
    
    And then run the frontend with npm:
    
    ```shell
    npm start
    
    meskio's avatar
    meskio committed
    ```
    
    
    The backend API will be listening on port 8080, while the frontend will be on port 3000.
    
    Open a browser and visit `http://localhost:3000`. You will be able to see any changes you do in the javascript side as you go (the backend side needs recompilation).
    
    meskio's avatar
    meskio committed
    
    ## Initialize data
    
    
    When you run cicer, it will print an authentication token.
    Use this token to seed some initial data (such a few users and products):
    
    ```shell
    ./setup.sh the.token.string
    
    meskio's avatar
    meskio committed
    ```
    
    meskio's avatar
    meskio committed
    
    ## Android
    
    Requires android studio to be installed in the system. With it you can build the apk from command line:
    
    ```
    make apk
    ```
    
    The built apk will be in `android/app/build/outputs/apk/release/app-release-unsigned.apk`.
    
    Or open android studio to test and build the app:
    
    ```
    make build
    npx cap copy
    npx cap open android
    ```
    
    ### sign the apk
    
    To sign the apk you need to have a key generated with:
    
    ```
    keytool -genkey -v -keystore release.keystore -alias release -keyalg RSA -keysize 2048 -validity 10000
    ```
    
    And then sign it:
    
    ```
    apksigner sign --ks ~/release.keystore --out app.apk app-release-unsigned.apk
    ```