Skip to content

Commit

Permalink
Fix extension setup issues
Browse files Browse the repository at this point in the history
- Added entrypoint script for db migration
- Modified dockerfile to run entrypoint script
- Modified README setup instructions
- Added gitignore for sonarqube files
  • Loading branch information
duggalsu authored and dennyabrain committed Jul 11, 2023
1 parent a5f2337 commit b3459c5
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 598 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.vscode
dom-html.txt
dom-html.txt
.scannerwork
3 changes: 2 additions & 1 deletion browser-extension/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node_modules/
node_modules/
.scannerwork
20 changes: 15 additions & 5 deletions browser-extension/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@

Requirements :

- npm : v8.7.0^
- nodejs : 16.4.2^
- npm : v8.3.1^
- nodejs : 16.14.0^

When you run `docker-compose up`, ensure to have a `development.env` file with the following variables in the `api-server` directory.

Expand All @@ -46,14 +46,24 @@ DB_PASSWORD: XXXXXXXXXXX

```
git clone https://github.com/tattle-made/OGBV.git
cd browser-extension/
cd OGBV/browser-extension/
cd plugin && npm install
cd ..
cd api-server && npm install
cd ..
docker-compose up
```

Setup the database by running `docker exec -it api-server npx sequelize-cli db:migrate`. You should be able to see uli related tables in the sql database now.
If you get `ERROR: Unknown database 'uli_dev'`
, the database was not successfully created and database migration failed. Manually create the `uli_dev` database by logging into `http://localhost:8080/` using the username and password from `OGBV/browser-extension/api-server/db/config/config.js` and execute the following

```
docker compose down -v
docker compose up
```
You should now see database migration in the logs. The `api-server` will be running now.


To run the the api server run `docker exec -it api-server npx sequelize-cli nodemon index.js`.

To run the plugin development server, run `cd plugin` and then the following :

Expand Down
5 changes: 4 additions & 1 deletion browser-extension/api-server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ RUN cd /app
RUN npm install
RUN npm install sequelize-cli
RUN npm install -g nodemon
COPY ./entrypoint.sh /
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
COPY . .

CMD ["node", "index.js"]
CMD ["node", "index.js"]
4 changes: 4 additions & 0 deletions browser-extension/api-server/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
npm install sequelize-cli
npx sequelize-cli db:migrate
nodemon index.js
Loading

0 comments on commit b3459c5

Please sign in to comment.