-
Notifications
You must be signed in to change notification settings - Fork 15
docs(setup): Add setup docs and easy install script #160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: deo002 <[email protected]>
There was a problem hiding this 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.
// 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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="[email protected]" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
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.
|
||
- 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.
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.
There was a problem hiding this comment.
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.
|
||
- 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
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.
- Build the app image | ||
|
||
```bash | ||
docker build -t licensedb/latest |
There was a problem hiding this comment.
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.
|
||
### 2. Setting up the database | ||
|
||
- Create database licensedb and provide user fossy all priviliges to it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 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. |
Changes
Submitter Checklist