docs(setup): Add setup docs and easy install script#160
docs(setup): Add setup docs and easy install script#160deo002 wants to merge 1 commit intofossology:mainfrom
Conversation
avinal
left a comment
There was a problem hiding this comment.
Looks good, some changes required.
cmd/laas/main.go
Outdated
| datafile = flag.String("datafile", "licenseRef.json", "(optional) path of the file from which licenses are to be imported") | ||
| // auto-update the database | ||
| populatedb = flag.Bool("populatedb", false, "boolean variable to update database") | ||
| populatedb = flag.Bool("populatedb", false, "(optional) boolean variable to populate database with licences, obligation types and classifications on start up") |
There was a problem hiding this comment.
| populatedb = flag.Bool("populatedb", false, "(optional) boolean variable to populate database with licences, obligation types and classifications on start up") | |
| populatedb = flag.Bool("populatedb", false, "(optional) boolean variable to populate database with licenses, obligation types and classifications on start up") |
Can safely ignore. Both are correct spellings, just in different regions. 😅
easy_install.sh
Outdated
| ADMIN_USER="fossy_super_admin" | ||
| ADMIN_PASS="fossy_super_admin" | ||
| ADMIN_DISPLAY="fossy_super_admin" | ||
| ADMIN_EMAIL="fossy_super_admin@licensedb.org" |
There was a problem hiding this comment.
| ADMIN_EMAIL="fossy_super_admin@licensedb.org" | |
| ADMIN_EMAIL="fossy_super_admin@example.org" |
I would not use a domain that we do not own. Use example domains if required.
There was a problem hiding this comment.
The script looks good. Since you have added prompts to show success, I would recommend adding error handling too. What happens if some step fails? We have to let the user know and stop the script. It should not be too hard; we just have to check the output/process at the end of each step and advance the script.
There was a problem hiding this comment.
i have set the relevant flags in this line: set -euo pipefail
This should be enough?
-e: exit immediately if any command in script fails
-u: treat unset env variables as error and exit immediately
-o pipefail: exit immediately if a command in the command chain(cmd1 | cmd2 | cmd3) fails
There was a problem hiding this comment.
Yes they are good. I just wanted to be as verbose as the other status message. Good for now I guess.
|
|
||
| - Create the `external_ref_fields.yaml` file in the root directory of the project and change the | ||
| values of the extra license json keys as per your requirement. | ||
| ### 3. Install golang-migrate CLI |
There was a problem hiding this comment.
Please add the command/script or refer to the repository.
There was a problem hiding this comment.
The instructions are under a wrong header; please fix.
README.md
Outdated
| ### 4. Install swagger document generator | ||
|
|
||
| - Generate Go struct for the extra fields listed in the external_ref_fields.yaml. | ||
| You'll need```swag``` installed to build swagger docs. |
There was a problem hiding this comment.
| You'll need```swag``` installed to build swagger docs. | |
| You'll need ```swag``` installed to build swagger docs. |
| #### For Linux & macOS | ||
|
|
||
| ```bash | ||
| go build ./cmd/laas | ||
| ``` | ||
|
|
||
| - Create the `.env` file in the root directory of the project and change the | ||
| values of the environment variables as per your requirement. | ||
|
|
||
| ```bash | ||
| cp configs/.env.dev.example .env | ||
| vim .env | ||
| ``` | ||
|
|
||
| - Run the migration files. | ||
| ```bash | ||
| migrate -path pkg/db/migrations -database "postgres://fossy:fossy@localhost:5432/licensedb?sslmode=disable" up | ||
| ``` | ||
|
|
||
| - Run the executable. | ||
|
|
||
| ```bash | ||
| ./laas | ||
| ``` | ||
|
|
||
| - You can directly run it by the following command. | ||
|
|
||
| ```bash | ||
| go run ./cmd/laas | ||
| curl -L https://github.com/golang-migrate/migrate/releases/latest/download/migrate.linux-amd64.tar.gz | tar xvz | ||
| sudo mv migrate /usr/local/bin/ | ||
| ``` | ||
|
|
||
| ### Create first user | ||
| Connect to the database using `psql` with the following command. | ||
| ```bash | ||
| psql -h localhost -p 5432 -U fossy -d licensedb | ||
| ``` | ||
| For other platforms and installation methods, check the official docs: | ||
| 👉 [https://github.com/golang-migrate/migrate](https://github.com/golang-migrate/migrate) |
There was a problem hiding this comment.
I believe this needs to go under step 3.
SETUP.md
Outdated
| - Build the app image | ||
|
|
||
| ```bash | ||
| docker build -t licensedb/latest |
There was a problem hiding this comment.
I think the reference to the Dockerfile and the context is missing. Please check.
There was a problem hiding this comment.
There are some things that need to be changed in the docker file. We have another PR open for that. We'll add the details here once it is merged.
SETUP.md
Outdated
|
|
||
| ### 2. Setting up the database | ||
|
|
||
| - Create database licensedb and provide user fossy all priviliges to it. |
There was a problem hiding this comment.
| - Create database licensedb and provide user fossy all priviliges to it. | |
| - Create database licensedb and provide user fossy all privileges to it. |
SETUP.md
Outdated
| swag fmt --generalInfo ./pkg/api/api.go --dir ./pkg/api,./pkg/auth,./pkg/db,./pkg/models,./pkg/utils | ||
| ``` | ||
|
|
||
| - The super admin user can only create new app users and import licenses and obligations. |
There was a problem hiding this comment.
| - The super admin user can only create new app users and import licenses and obligations. | |
| - Only the super admin user can create new app users, import licenses and obligations. |
Signed-off-by: deo002 <oberoidearsh@gmail.com>
Changes
Submitter Checklist