Skip to content

Commit ae57511

Browse files
committed
refactor: enhance security by updating gitignore and workflow files to protect sensitive information
- Add comprehensive patterns for sensitive files in .gitignore - Update deploy workflow to clean up temporary credentials - Exclude additional configuration and secret files - Add protection for environment-specific files
1 parent 7f7a267 commit ae57511

File tree

39,155 files changed

+223
-4859886
lines changed

Some content is hidden

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

39,155 files changed

+223
-4859886
lines changed

build_and_run.sh

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
#!/bin/bash
2-
3-
# Build Maven project
4-
mvn clean install
5-
6-
# Build Docker images
7-
services=("eureka-server" "recommendation-service" "statistics-service" "api-gateway" "user-tracking-service")
8-
for service in "${services[@]}"; do
9-
echo "Building Docker image for $service..."
10-
cd $service
11-
docker build -t $service .
12-
cd ..
13-
done
14-
15-
# Run Docker Compose
1+
#!/bin/bash
2+
3+
# Build Maven project
4+
mvn clean install
5+
6+
# Build Docker images
7+
services=("eureka-server" "recommendation-service" "statistics-service" "api-gateway" "user-tracking-service")
8+
for service in "${services[@]}"; do
9+
echo "Building Docker image for $service..."
10+
cd $service
11+
docker build -t $service .
12+
cd ..
13+
done
14+
15+
# Run Docker Compose
1616
docker-compose up

.env.template

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,8 @@ VM_IP=your-vm-ip
77
VM_USER=your-vm-username
88
SSH_KEY_PATH=path-to-your-ssh-key
99

10+
# Service Hostname
11+
ORACLE_EXTERNAL_HOSTNAME=your-instance-hostname-or-ip
12+
1013
# Note: Copy this file to .env and fill in your actual values
1114
# DO NOT commit the .env file to version control

.github/workflows/ci.yml

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +0,0 @@
1-
name: CI/CD Pipeline
2-
3-
on:
4-
push:
5-
branches:
6-
- main
7-
pull_request:
8-
branches:
9-
- main
10-
11-
jobs:
12-
build:
13-
runs-on: ubuntu-latest
14-
15-
steps:
16-
- name: Checkout code
17-
uses: actions/checkout@v2
18-
19-
- name: Set up Docker Compose
20-
run: |
21-
sudo apt-get update
22-
sudo apt-get install -y docker-compose
23-
24-
- name: Set up JDK 21
25-
uses: actions/setup-java@v2
26-
with:
27-
java-version: 21
28-
distribution: 'temurin'
29-
30-
- name: Build with Maven
31-
run: mvn clean install
32-
working-directory: .
33-
34-
- name: Build Docker images
35-
run: docker-compose build
36-
37-
- name: Run unit tests
38-
run: mvn test
39-
working-directory: .
40-
41-
- name: Run integration tests
42-
run: mvn verify
43-
working-directory: .
44-
45-
- name: Set up database
46-
run: |
47-
docker-compose up -d db
48-
sleep 10 # wait for the database to be ready
49-
50-
- name: Run database migrations
51-
run: mvn flyway:migrate
52-
working-directory: .

.github/workflows/deploy.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Deploy to Oracle VM
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v2
15+
16+
- name: Set up JDK 17
17+
uses: actions/setup-java@v2
18+
with:
19+
java-version: '17'
20+
distribution: 'temurin'
21+
22+
- name: Build with Maven
23+
run: mvn clean install -DskipTests
24+
25+
- name: Set up Docker Buildx
26+
uses: docker/setup-buildx-action@v1
27+
28+
- name: Log in to Oracle Container Registry
29+
uses: docker/login-action@v1
30+
with:
31+
registry: ${{ secrets.OCI_REGISTRY }}
32+
username: ${{ secrets.OCI_USERNAME }}
33+
password: ${{ secrets.OCI_AUTH_TOKEN }}
34+
35+
- name: Build and push Docker images
36+
env:
37+
REGISTRY: ${{ secrets.OCI_REGISTRY }}
38+
NAMESPACE: ${{ secrets.OCI_NAMESPACE }}
39+
run: |
40+
docker build -t ${REGISTRY}/${NAMESPACE}/api-gateway:latest -f api-gateway/Dockerfile .
41+
docker build -t ${REGISTRY}/${NAMESPACE}/eureka-server:latest -f eureka-server/Dockerfile .
42+
docker build -t ${REGISTRY}/${NAMESPACE}/recommendation-service:latest -f recommendation-service/Dockerfile .
43+
docker build -t ${REGISTRY}/${NAMESPACE}/statistics-service:latest -f statistics-service/Dockerfile .
44+
docker build -t ${REGISTRY}/${NAMESPACE}/user-tracking-service:latest -f user-tracking-service/Dockerfile .
45+
docker push ${REGISTRY}/${NAMESPACE}/api-gateway:latest
46+
docker push ${REGISTRY}/${NAMESPACE}/eureka-server:latest
47+
docker push ${REGISTRY}/${NAMESPACE}/recommendation-service:latest
48+
docker push ${REGISTRY}/${NAMESPACE}/statistics-service:latest
49+
docker push ${REGISTRY}/${NAMESPACE}/user-tracking-service:latest
50+
51+
deploy:
52+
runs-on: ubuntu-latest
53+
needs: build
54+
55+
steps:
56+
- name: Checkout code
57+
uses: actions/checkout@v2
58+
59+
- name: Deploy to Oracle VM
60+
env:
61+
ORACLE_VM_IP: ${{ secrets.ORACLE_VM_IP }}
62+
run: |
63+
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ssh_key.pem
64+
chmod 600 ssh_key.pem
65+
ssh -o StrictHostKeyChecking=no -i ssh_key.pem opc@${ORACLE_VM_IP} << 'EOF'
66+
cd ~/music-analytics/vm-deploy
67+
docker login ${REGISTRY} -u ${{ secrets.OCI_USERNAME }} -p ${{ secrets.OCI_AUTH_TOKEN }}
68+
docker-compose pull
69+
docker-compose up -d
70+
EOF
71+
rm -f ssh_key.pem # Clean up sensitive files

.gitignore

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,24 @@ target/
2121

2222
# Environment files with sensitive information
2323
.env
24+
.env.*
25+
!.env.template
26+
set_oracle_env.bat
2427
*.pem
2528
*.key
2629

30+
# Additional sensitive files
31+
**/application-*.yml
32+
**/application-*.properties
33+
!**/application.yml
34+
!**/application.properties
35+
**/secrets/
36+
**/*.password
37+
**/*.secret
38+
**/*.token
39+
**/credentials.*
40+
**/private-key.*
41+
2742
# Build and deployment artifacts
2843
vm-deploy/
2944
cloud-deploy/
@@ -47,4 +62,14 @@ Thumbs.db
4762

4863
# Node modules for frontend
4964
frontend/node_modules/
50-
frontend/build/
65+
frontend/build/
66+
frontend/.env.*
67+
!frontend/.env.template
68+
69+
# Ignore SSH configuration directory
70+
/.ssh
71+
72+
# Oracle Cloud specific
73+
**/ssh-key-*.key
74+
**/oracle/*.key
75+
**/oracle/*.pem

.idea/.gitignore

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

.idea/MusicAnalyticsPlatform.iml

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

.idea/misc.xml

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

.idea/modules.xml

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

.idea/vcs.xml

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

0 commit comments

Comments
 (0)