Skip to content

Conversation

@deo002
Copy link
Collaborator

@deo002 deo002 commented Aug 22, 2025

Changes

  • Add clear set up docs for different ways to run the project
  • Add easy install script
  • Improve README.

Submitter Checklist

  • Includes tests (if there is a feature changed/added)
  • Includes docs ( if changes are user facing)
  • I have tested my changes locally.

Copy link
Member

@avinal avinal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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="[email protected]"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add the command/script or refer to the repository.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this needs to go under step 3.

SETUP.md Outdated
- Build the app image

```bash
docker build -t licensedb/latest
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the reference to the Dockerfile and the context is missing. Please check.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- 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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants