Skip to content

Commit fb932aa

Browse files
Merge pull request #168 from intelops/add-support-for-other-git-platforms
Add Cassandra and Sqilte as data store in app, support for multiple gitPlatform
2 parents 552f976 + 093e028 commit fb932aa

File tree

499 files changed

+64378
-26817
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

499 files changed

+64378
-26817
lines changed

.github/workflows/core-ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,11 @@ jobs:
115115
with:
116116
# relative path to the place where source code with Dockerfile is located
117117
context: ./core
118-
# Note: tags has to be all lower-case
118+
# Note: tags have to be all lower-case
119119
tags: ${{ env.REGISTRY }}/${{ github.repository }}/core:${{ github.run_id }}
120120
# ${{ steps.metadata.outputs.tags }}
121121
labels: ${{ steps.metadata.outputs.labels }}
122-
# build on feature branches, push only on main branch
122+
# build on feature branches, push only on the main branch
123123
push: true
124124
# - uses: goodwithtech/dockle-action@main
125125
# with:

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,6 @@
1111
/app/coverage
1212
openapitools.json
1313
/core/openapitools.json
14-
/ui/.env.kind.cluster
14+
/ui/.env.kind.cluster
15+
/app/compage-app.sqlite3
16+
/deploy/build/

CONTRIBUTING.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,13 @@ To contribute code,
2828
5. Fork the project.
2929
6. Clone the project: `git clone https://github.com/[YOUR_USERNAME]/compage && cd compage`
3030
7. kindly refer compage.md file to know the structure of the project.
31-
8. Refer [GitHub App setup](./github-app-setup.md)
32-
9. The Compage has 3 servers (subprojects) which need to be started to run the compage on local
31+
8. The Compage has 3 servers (subprojects) which need to be started to run the compage on local
3332
- core (Golang), navigate to core directory and follow its [core README](./core/README.md)
34-
- app (Nodejs), navigate to app directory and follow its [app README](./app/README.md)
33+
- app (NodeJs), navigate to app directory and follow its [app README](./app/README.md)
3534
- ui (ReactJs), navigate to ui directory and follow its [ui README](./ui/README.md)
36-
10. Commit changes *([Please refer the commit message conventions](https://www.conventionalcommits.org/en/v1.0.0/))*
37-
11. Push commits.
38-
12. Open pull request.
35+
9. Commit changes *([Please refer the commit message conventions](https://www.conventionalcommits.org/en/v1.0.0/))*
36+
10. Push commits.
37+
11. Open pull request.
3938
4039
## Improving the Documentation
4140
The documentation is contained within `./docs` and made with Docusaurus. See the [Docs README](./docs/README.md) for infos about developing the docs.

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,6 @@ Active communication channels
164164

165165
## Quick start
166166

167-
- Register an app - Refer [GitHub App setup](./github-app-setup.md).
168167
- Follow step-by-step instructions given here [Run Compage on local](./deploy/README.md).
169168

170169
## License

app/Dockerfile

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# build environment
2-
FROM node:18.15-alpine as builder
2+
FROM node:18.18.0-alpine3.18 as builder
33
WORKDIR /app
44
COPY . .
55
RUN npm install -g npm@latest && npm install --production=false && \
@@ -10,13 +10,17 @@ RUN npm install -g npm@latest && npm install --production=false && \
1010
npm install
1111

1212
# production environment
13-
FROM node:18.15-alpine
13+
FROM node:18.18.0-alpine3.18
1414
WORKDIR /server
1515
RUN apk update && apk add git
1616
COPY --from=builder /app/dist /server/dist
1717
COPY --from=builder /app/node_modules /server/node_modules
1818
COPY --from=builder /app/protobufs /server/protobufs
19-
19+
### Add new user
20+
RUN adduser -D -g '' compageuser
21+
RUN mkdir -p $HOME/.compage/workdir
22+
RUN chmod -R 777 $HOME/.compage/workdir
23+
USER compageuser
2024
ENV NODE_ENV=production
2125
EXPOSE 5000
2226
CMD [ "node", "dist/src/app.js" ]

app/README.md

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,20 @@
11
# app
2-
- This component integrates the GitHub Oauth2 App for authentication.
3-
- This also uses K8s's etcd store to persist projects and users related data.
4-
- It's an Express JS based REST server and gRPC client to core component.
2+
- This is a component that connects to different git-platforms and push-pull repositories.
3+
- This also uses Cassandra or SQLite (based on configuration) databases to persist projects, git platforms, and users related details.
4+
- It's an Express.js based REST server and gRPC client to a core component.
5+
- The sqlite is used as a database for development. To use cassandra, you need to set the following environment variables in your terminal along with a `environment DB_TYPE='cassandra'`.
6+
```bash
7+
export CASSANDRA_CONTACT_POINTS = 'localhost';
8+
export CASSANDRA_LOCAL_DATA_CENTER = 'datacenter1';
9+
export CASSANDRA_KEYSPACE = 'compage';
10+
export CASSANDRA_USERNAME = 'cassandra';
11+
export CASSANDRA_PASSWORD = 'cassandra';
12+
```
13+
- To start the cassandra server on local, you can fire command `docker-compose up -d` from the setup directory of compage/app.
514

615
#### How to run this component?
716
- Navigate to app directory [`cd app`] from root directory of compage
817
- Fire `npm install` to install the dependencies
9-
- Install the CRDs for projects and users (when you are running for the first time.) by firing below commands
10-
- `kubectl create ns compage`
11-
- `kubectl config set-context --current --namespace=compage`
12-
- `kubectl apply -f crds/project-crd.yaml`
13-
- `kubectl apply -f crds/user-crd.yaml`
14-
- Check if you are able to list `projects` and `users`. You should see below just after you fire above commands for the first time.
15-
```shell
16-
❯ kubectl get projects -A
17-
No resources found
18-
```
19-
and
20-
```shell
21-
❯ kubectl get users -A
22-
No resources found
23-
```
24-
- If you find some other error apart from the above one, that means the installation of CRDs didn't succeed.
25-
- Run `npm run dev` command to start the express-server. This command will auto-reload the changes you make to app directory.
18+
- Run `npm run dev` command to start the express-server. This command will auto-reload the changes you make to app directory.
19+
- If something goes wrong, you want to kill the process on port 5000, run the following command
20+
```sudo kill -9 `sudo lsof -t -i:5000```

app/crds/project-crd.yaml

Lines changed: 0 additions & 70 deletions
This file was deleted.

app/crds/user-crd.yaml

Lines changed: 0 additions & 38 deletions
This file was deleted.

app/devspace.yaml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,10 @@ deployments:
4444
env:
4545
- name: NODE_ENV
4646
value: development
47-
- name: GITHUB_APP_CLIENT_ID
48-
value: ${GITHUB_APP_CLIENT_ID}
49-
- name: GITHUB_APP_CLIENT_SECRET
50-
value: ${GITHUB_APP_CLIENT_SECRET}
51-
- name: GITHUB_APP_REDIRECT_URI
52-
value: ${GITHUB_APP_REDIRECT_URI}
5347
- name: COMPAGE_CORE_URL
5448
value: ${COMPAGE_CORE_URL}
49+
- name: LOG_LEVEL
50+
value: debug
5551
service:
5652
ports:
5753
- port: 5000

0 commit comments

Comments
 (0)