Repository navigation
docs(setup): Add setup docs and easy install script - #160
Conversation
avinal
left a comment
There was a problem hiding this comment.
Looks good, some changes required.
| 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. 😅
| 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.
|
|
||
| - 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.
| ### 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.
| - 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.
|
|
||
| ### 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. |
| 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. |
0bf9ee9 to
51e9d37
Compare
There was a problem hiding this comment.
Hey @deo002 , I think we dont need the easy script part anymore. It was planned when both frontend and backend setup was discussed.
We should push for Docker and Bare Metal installation. Operationally this will lag behind otherwise.
Other point is: If we are removing the setup guide from README, We should also add some of the other things that should be there in a README. Like project description. Features and Functionalities etc etc.
Basic Testing and running steps (With Docker) can also be mentioned in the README. Link all the other documents that we have in the projects. Like Contributing & Setup(bare metal)
I like the ER Diagram idea, but it doesnt load anymore.
| TOKEN_HOUR_LIFESPAN=1 | ||
| # Secret key to sign tokens (openssl rand -hex 32) | ||
| API_SECRET=some-random-string | ||
| API_SECRET=0195067722c9213eee87c3db9b087ade |
There was a problem hiding this comment.
do we need to type a SECRET looking string in API_SECRET? Can we put these steps in README? Setup guide? Like how to generate and what variable to update?
| # refresh token information(30 days) | ||
| REFRESH_TOKEN_HOUR_LIFESPAN=720 | ||
| REFRESH_TOKEN_SECRET=some-other-random-string | ||
| REFRESH_TOKEN_SECRET=d78cded51eff6ab87e255b8f72f2215c |
| # SPDX-FileCopyrightText: 2025 Dearsh Oberoi <dearsh.oberoi@siemens.com> | ||
| # SPDX-License-Identifier: GPL-2.0-only | ||
|
|
||
| set -euo pipefail |
There was a problem hiding this comment.
I am not sure about creating one more setup mechanism. We already have something similar to this for Docker.
| # add the same yaml file to your frontend project | ||
|
|
There was a problem hiding this comment.
Added a line regarding this in the Post Install section of SETUP.md
| ### Option 2: Run with Docker Compose (recommended) | ||
|
|
||
| A `docker-compose.yml` is included in this repository to make it easy to spin up LicenseDB along with PostgreSQL. | ||
| You'll need ```swag``` installed to build swagger docs. |
There was a problem hiding this comment.
If we are creating a separate guide for setup, That information should exclusively be there.
| ``` | ||
| 👉 Please follow the [Setup Guide](./SETUP.md) for step-by-step instructions on how to run the project. | ||
|
|
||
| ### Testing (local) |
There was a problem hiding this comment.
This also then belong to setup.md then
| ## 1. Easy Install Script | ||
|
|
||
| The easiest of them all is via the easy install script. | ||
|
|
||
| - (Optional) Edit the ```configs/.env.dev.example``` to set the environment variables. If not done, default values will be taken. | ||
|
|
||
| - (Optional) Edit the ```external_ref_fields.example.yaml``` to extend the schema of licenses and obligations with custom fields. If not done, default values will be taken. | ||
|
|
||
| - Run the easy install script to generate the app binary. | ||
|
|
||
| ```bash | ||
| ./easy_install.sh | ||
| ``` | ||
|
|
||
| - Run the executable | ||
|
|
||
| ```bash | ||
| ./laas | ||
| ``` | ||
|
|
||
| Use the command below for more startup options. | ||
|
|
||
| ```bash | ||
| ./laas --help | ||
| ``` |
There was a problem hiding this comment.
Nope, This should not be the primary way for the installation. I dont think this should even be a way altogether
| ```bash | ||
| docker build -t licensedb/latest . | ||
| ``` |
There was a problem hiding this comment.
We can also mention the DockerHub/GHCR image where we push some of the latest builds.
34270e8 to
c295fa7
Compare
Signed-off-by: deo002 <oberoidearsh@gmail.com>
Changes
Submitter Checklist