Skip to content

Commit 2582e28

Browse files
authored
Merge pull request #84 from oslabs-beta/dev
Version 0.1.0
2 parents 2b47ede + 81bbfbb commit 2582e28

Some content is hidden

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

58 files changed

+12132
-2
lines changed

.dockerignore

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Include any files or directories that you don't want to be copied to your
2+
# container here (e.g., local build artifacts, temporary files, etc.).
3+
#
4+
# For more help, visit the .dockerignore file reference guide at
5+
# https://docs.docker.com/go/build-context-dockerignore/
6+
7+
**/.classpath
8+
**/.dockerignore
9+
**/.env
10+
**/.git
11+
**/.gitignore
12+
**/.project
13+
**/.settings
14+
**/.toolstarget
15+
**/.vs
16+
**/.vscode
17+
**/.next
18+
**/.cache
19+
**/*.*proj.user
20+
**/*.dbmdl
21+
**/*.jfm
22+
# **/charts
23+
**/docker-compose*
24+
**/compose.y*ml
25+
**/Dockerfile*
26+
**/node_modules
27+
**/npm-debug.log
28+
**/obj
29+
**/secrets.dev.yaml
30+
**/values.dev.yaml
31+
**/build
32+
**/dist
33+
LICENSE
34+
README.md

.github/workflows/lint.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# .github/workflows/lint-format.yml
2+
3+
name: Lint and Format
4+
5+
# Run this workflow on pull requests targeting 'main' or 'dev' branches
6+
on:
7+
pull_request:
8+
branches:
9+
- main
10+
- dev
11+
12+
jobs:
13+
lint-and-format:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
# Step 1: Check out the code
18+
- name: Checkout code
19+
uses: actions/checkout@v4
20+
21+
# Step 2: Set up Node.js (specify the Node version if required)
22+
- name: Set up Node.js
23+
uses: actions/setup-node@v3
24+
with:
25+
node-version: '20' # Adjust the version if necessary
26+
27+
# Step 3: Install dependencies
28+
- name: Install dependencies
29+
run: npm install
30+
31+
# Step 4: Run ESLint to check for linting issues
32+
- name: Run ESLint
33+
run: npm run lint -- --fix # Make sure you have a lint script in package.json
34+
35+
- name: List Changes
36+
run: git status --porcelain
37+
38+
# Step 6: Check for changes after formatting
39+
- name: Check for formatting changes
40+
run: |
41+
if [[ `git status --porcelain` ]]; then
42+
echo "There are formatting changes."
43+
echo "Please commit the changes locally or configure auto-formatting in Prettier."
44+
exit 1
45+
else
46+
echo "No formatting changes needed."
47+
fi

.gitignore

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,26 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
pnpm-debug.log*
8+
lerna-debug.log*
9+
110
node_modules
2-
.DS_STORE
11+
dist
12+
dist-ssr
13+
*.local
14+
*.tsbuildinfo
315
.env
16+
17+
# Editor directories and files
18+
.vscode/*
19+
!.vscode/extensions.json
20+
.idea
21+
.DS_Store
22+
*.suo
23+
*.ntvs*
24+
*.njsproj
25+
*.sln
26+
*.sw?

.prettierrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"semi": true,
3+
"singleQuote": true,
4+
"printWidth": 80,
5+
"trailingComma": "es5"
6+
}

Dockerfile

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# syntax=docker/dockerfile:1
2+
ARG NODE_VERSION=20.16.0
3+
4+
################################################################################
5+
# Use node image for base image for all stages.
6+
FROM node:${NODE_VERSION}-alpine AS base
7+
8+
# Set working directory for all build stages.
9+
WORKDIR /usr/src/app
10+
11+
12+
################################################################################
13+
# Create a stage for installing production dependecies.
14+
FROM base AS deps
15+
16+
# Download dependencies as a separate step to take advantage of Docker's caching.
17+
# Leverage a cache mount to /root/.npm to speed up subsequent builds.
18+
# Leverage bind mounts to package.json and package-lock.json to avoid having to copy them
19+
# into this layer.
20+
RUN --mount=type=bind,source=package.json,target=package.json \
21+
# workaround for npm optional dependencies bug: https://github.com/npm/cli/issues/4828
22+
# --mount=type=bind,source=package-lock.json,target=package-lock.json \
23+
--mount=type=cache,target=/root/.npm \
24+
npm i --omit=dev
25+
26+
################################################################################
27+
# Create a stage for building the application.
28+
FROM deps AS dev-deps
29+
30+
31+
# Download additional development dependencies before building, as some projects require
32+
# "devDependencies" to be installed to build. If you don't need this, remove this step.
33+
RUN --mount=type=bind,source=package.json,target=package.json \
34+
# workaround for npm optional dependencies bug: https://github.com/npm/cli/issues/4828
35+
# --mount=type=bind,source=package-lock.json,target=package-lock.json \
36+
--mount=type=cache,target=/root/.npm \
37+
npm i
38+
39+
FROM dev-deps AS build
40+
# Copy the rest of the source files into the image.
41+
COPY . .
42+
# Run the build script.
43+
RUN npx tsc -b
44+
RUN npx vite build
45+
46+
################################################################################
47+
# Create a new stage to run the application with minimal runtime dependencies
48+
# where the necessary files are copied from the build stage.
49+
FROM base AS final
50+
51+
# Use production node environment by default.
52+
ENV NODE_ENV=production
53+
54+
# Run the application as a non-root user.
55+
USER node
56+
57+
# Copy package.json so that package manager commands can be used.
58+
COPY package.json .
59+
60+
# Copy the production dependencies from the deps stage and also
61+
# the built application from the build stage into the image.
62+
COPY --from=deps /usr/src/app/node_modules ./node_modules
63+
COPY --from=build /usr/src/app/server ./
64+
COPY --from=build /usr/src/app/dist ./dist
65+
66+
67+
68+
# Expose the port that the application listens on.
69+
EXPOSE 8080
70+
71+
# Run the application.
72+
CMD [ "node", "server.js" ]

Dockerfile-postgres

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
FROM postgres:12.8
2+
COPY ./scripts/db_init.sql /docker-entrypoint-initdb.d/

README.Docker.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
### Building and running your application
2+
3+
When you're ready, start your application by running:
4+
`docker compose up --build`.
5+
6+
Your application will be available at http://localhost:8080.
7+
8+
### Deploying your application to the cloud
9+
10+
First, build your image, e.g.: `docker build -t myapp .`.
11+
If your cloud uses a different CPU architecture than your development
12+
machine (e.g., you are on a Mac M1 and your cloud provider is amd64),
13+
you'll want to build the image for that platform, e.g.:
14+
`docker build --platform=linux/amd64 -t myapp .`.
15+
16+
Then, push it to your registry, e.g. `docker push myregistry.com/myapp`.
17+
18+
Consult Docker's [getting started](https://docs.docker.com/go/get-started-sharing/)
19+
docs for more detail on building and pushing.
20+
21+
### References
22+
* [Docker's Node.js guide](https://docs.docker.com/language/nodejs/)

README.md

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,49 @@
1-
# TrailGuide
1+
# TrailGuide
2+
3+
[TrailGuide](https://oslabs-beta.github.io/TrailGuideIO/) is a open source AWS cloud security solution for developers who need their cloud security reassured.
4+
5+
We built TrailGuide because we are passionate in solving the data overloading problem in the cloud. Join us!
6+
7+
- Track key management events: Quickly view events related to creating, modifying, or deleting AWS resources.
8+
- Visualize CloudTrail data: Present data in easy-to-read formats, such as pie charts for event distribution and heatmaps for geographical IP access.
9+
- Analyze recent events based on various criteria, such as IP addresses, event types, associated users, and timestamps.
10+
11+
Every single part is fully open source! Fork it, extend it, or deploy it to your own server.
12+
13+
<img src="./readmeAssets//trailguide-readme-main.webp" alt="List View Screenshot" width="500">
14+
15+
# Installation and Spin-Up
16+
17+
- Make sure you have docker installed
18+
- Create your compose.yml file
19+
- (see our starter version in [Docker Hub](https://hub.docker.com/r/trailguide/trailguide-prod), or copy the one from this repo )
20+
- run `docker compose up` on the command line
21+
22+
# Getting Start:
23+
24+
1. Use the signup link to create user
25+
26+
<img src="./readmeAssets/sign-up.png" alt="List View Screenshot" width="500">
27+
28+
2. Login
29+
30+
<img src="./readmeAssets/log-in.png" alt="List View Screenshot" width="500">
31+
32+
3. Copy paste the aws credentials in the fields in the profile
33+
34+
<img src="./readmeAssets/aws-credential.png" alt="List View Screenshot" width="500">
35+
36+
## Shoutouts :tada:
37+
38+
Omnivore takes advantage of some great open source software:
39+
40+
- [TypeScript](https://www.typescriptlang.org/) - Most of our backend and frontend are written in TypeScript.
41+
- [PostgreSQL](https://www.postgresql.org/)- For managing complex queries and storing event data, PostgreSQL is our go-to. Its reliability and performance are key to managing and analyzing extensive data, enhancing the robustness of our monitoring and analytics features.
42+
- [Docker](https://www.docker.com/)- Thanks to Docker, deploying our platform is seamless and consistent, whether locally or on the cloud. Docker allows us to containerize our ML models and backend services, ensuring reliable and scalable performance for our users.
43+
- [AWS](https://aws.amazon.com/)- AWS forms the backbone of TrailGuide, providing the infrastructure and data streams that allow us to offer real-time monitoring and security insights for AWS environments. CloudTrail logs enable us to dive deep into user activity and detect anomalies as they happen.
44+
- [Scikit-learn](https://scikit-learn.org/)- TrailGuide’s anomaly detection thrives with Scikit-learn's Isolation Forest, enabling real-time detection of unusual activity in CloudTrail logs with efficiency and accuracy.
45+
- And many more awesome libraries, just checkout our package files to see what we are using.
46+
47+
## Requirements for development
48+
49+
TraildeGuide is written in TypeScript and JavaScript.

client/index.html

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<meta name="description" content="A brief description of your application." />
7+
<link href="https://fonts.googleapis.com/css2?family=Fredoka&display=swap" rel="stylesheet">
8+
<link href="https://fonts.googleapis.com/css2?family=M+PLUS+Rounded+1c&display=swap" rel="stylesheet">
9+
<link rel="icon" href="path/to/favicon.ico" />
10+
<title>TrailGuide</title>
11+
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
12+
</head>
13+
<body>
14+
<div id="root"></div>
15+
<script type="module" src="src/main.tsx" defer></script>
16+
</body>
17+
</html>

0 commit comments

Comments
 (0)