Skip to content
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

Host Backend on AWS #88

Merged
merged 63 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from 43 commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
779886d
added workflow to deploy to ecs
MehulKChaudhari Feb 2, 2024
325abfa
add aws region
MehulKChaudhari Feb 2, 2024
0f7782b
add env
MehulKChaudhari Feb 2, 2024
b795805
fix secret variable name
MehulKChaudhari Feb 2, 2024
8752c4c
fix dockerfile path
MehulKChaudhari Feb 2, 2024
52ae9c8
make mvn executable
MehulKChaudhari Feb 2, 2024
ac85ca9
fix path dockerfile
MehulKChaudhari Feb 2, 2024
e30fe91
fix target path
MehulKChaudhari Feb 2, 2024
6f67182
fix: cluster same
MehulKChaudhari Feb 2, 2024
98f93fc
login docker seprately
MehulKChaudhari Feb 2, 2024
63d954d
update aws region
MehulKChaudhari Feb 2, 2024
77a5435
add new cluster
MehulKChaudhari Feb 2, 2024
1109398
fix cluster name
MehulKChaudhari Feb 2, 2024
c621ebc
change cluster name
MehulKChaudhari Feb 3, 2024
b263915
Merge branch 'develop' into docker-aws
Achintya-Chatterjee Feb 4, 2024
9900c91
fix secrets
MehulKChaudhari Feb 5, 2024
71a9455
add workflow file
MehulKChaudhari Mar 1, 2024
9ca2da1
add env while building
MehulKChaudhari Mar 2, 2024
34c6aff
fix image name
MehulKChaudhari Mar 2, 2024
717d8db
add image repo URI in secrets
MehulKChaudhari Mar 2, 2024
ad70634
fix dockerfile path
MehulKChaudhari Mar 2, 2024
4df18cf
add workflow file
MehulKChaudhari Mar 6, 2024
9133cf4
fix CI to run push
MehulKChaudhari Mar 6, 2024
6689fce
temp: fix to check if deployment works
MehulKChaudhari Mar 6, 2024
b2cddab
add deploy to ec2 back
MehulKChaudhari Mar 6, 2024
537d35b
fix ECR public login
MehulKChaudhari Mar 8, 2024
f09b86f
fix ECR public URI
MehulKChaudhari Mar 8, 2024
366c876
fix ecr login command
MehulKChaudhari Mar 8, 2024
9723b9c
fix login command
MehulKChaudhari Mar 9, 2024
c2e6c0b
fix dockerfile
MehulKChaudhari Mar 9, 2024
55a7175
fix docker push command
MehulKChaudhari Mar 10, 2024
1f39992
fix tag and push
MehulKChaudhari Mar 10, 2024
0c801d7
fix ecr login
MehulKChaudhari Mar 10, 2024
980aa1c
fix aws login
MehulKChaudhari Mar 10, 2024
6a88aff
fix aws region
MehulKChaudhari Mar 10, 2024
2b3c307
fix ecr-public login region
MehulKChaudhari Mar 10, 2024
1d3eab4
deploy to ec2
MehulKChaudhari Mar 10, 2024
6157c51
Merge branch 'develop' into docker-aws
MehulKChaudhari Mar 10, 2024
8b00b9b
Update deploy-to-ec2.yml
MehulKChaudhari Mar 10, 2024
6ef32d9
check UI is working or not
MehulKChaudhari Mar 12, 2024
a41b4b5
fix: broken change
MehulKChaudhari Mar 12, 2024
fc73668
Merge branch 'develop' into docker-aws
prakashchoudhary07 Mar 12, 2024
01eb236
Merge branch 'develop' into docker-aws
iamitprakash Mar 17, 2024
224412f
Merge branch 'develop' into docker-aws
MehulKChaudhari Mar 24, 2024
57f1ec9
change the action runner
MehulKChaudhari May 8, 2024
ab161da
change branch for testing.
MehulKChaudhari May 8, 2024
51f7c17
instead of script add steps
MehulKChaudhari May 8, 2024
12662a0
update readme and tokens for integration test (#104)
bhtibrewal Apr 7, 2024
f1b84fc
(#114)-Downgrading JWT Libraries as short-term fix for Public Key Siz…
akhilkh2000 Apr 20, 2024
5c3d653
Adding integration tests for endorsement service (#107)
Chethan64 Apr 21, 2024
cb2d58b
added implementation for V1 search endorsements based on dummy data
akhilkh2000 Mar 19, 2024
82566a8
Enabled Unit and Integration tests, Auth whitelist for /v1/endorsements
akhilkh2000 Apr 21, 2024
053e5bf
Formatting fixed
akhilkh2000 Apr 21, 2024
81e8966
Put dummyData implementation behind dummyData=true feature flag, old …
akhilkh2000 May 2, 2024
af9ed1f
formatting fixed
akhilkh2000 May 2, 2024
93bcc0b
pass public key as env variable
MehulKChaudhari May 10, 2024
e83465b
fix: remove extra space
MehulKChaudhari May 10, 2024
2ec0c36
add api v1 prefix and data source version
MehulKChaudhari May 10, 2024
f7edcae
fix: command format
MehulKChaudhari May 10, 2024
76a16a3
fix: remove extra env
MehulKChaudhari May 10, 2024
08664ab
fix: change branch name
MehulKChaudhari May 10, 2024
29b1de8
Merge branch 'develop' into docker-aws
MehulKChaudhari May 10, 2024
8d453f4
Merge branch 'develop' into docker-aws
prakashchoudhary07 May 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ jobs:
distribution: 'temurin'

- name: Build with Maven
run: mvn verify --file skill-tree/pom.xml
run: mvn verify --file skill-tree/pom.xml
45 changes: 45 additions & 0 deletions .github/workflows/deploy-to-ec2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Deploy to EC2

on:
push:
branches:
- main

jobs:
build-and-push:
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v3

- name: Set up AWS CLI
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}

- name: Login to Amazon ECR Public
id: login-ecr
run: aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin ${{ secrets.AWS_ECR_URI }}

- name: Build Docker image
run: docker build -t skill-tree-backend -f skill-tree/Dockerfile .
- name: Tag Docker image
run: docker tag skill-tree-backend:latest ${{ secrets.AWS_ECR_URI }}/skill-tree-backend:latest

- name: Push Docker image to ECR Public
run: docker push ${{ secrets.AWS_ECR_URI }}/skill-tree-backend:latest

deploy:
needs: build-and-push
runs-on: [skill-tree-ec2]
steps:
- name: Pull Image from docker hub
run: docker pull ${{ secrets.AWS_ECR_URI }}/skill-tree-backend:latest
- name: Delete old container
run: docker rm -f skill-tree-backend
- name: Run docker container
run: docker run -d -p 8080:8080 --name skill-tree-backend ${{ secrets.AWS_ECR_URI }}/skill-tree-backend

3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ replay_pid*
.idea/
.vscode/

*.env
*.env
target
11 changes: 11 additions & 0 deletions skill-tree/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM openjdk:17-jdk as build
WORKDIR /app
COPY skill-tree .
RUN ./mvnw --version
RUN ./mvnw clean install -DskipTests

FROM openjdk:17-jdk
WORKDIR /app
COPY --from=build /app/target/*.jar app.jar
EXPOSE 8080
ENTRYPOINT ["java", "-jar", "app.jar"]
30 changes: 26 additions & 4 deletions skill-tree/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ version: "3.7"
services:
db:
image: mysql
# NOTE: use of "mysql_native_password" is not recommended: https://dev.mysql.com/doc/refman/8.0/en/upgrading-from-previous-series.html#upgrade-caching-sha2-password
# (this is just an example, not intended to be a production configuration)
command: --default-authentication-plugin=mysql_native_password
ports:
- 3306:3306
Expand All @@ -13,9 +11,33 @@ services:
MYSQL_PASSWORD: testpassword
MYSQL_ROOT_PASSWORD: password
volumes:
- ./skilltree-database-script.sql:/docker-entrypoint-initdb.d/skilltree-database-script.sql
- mysql-data:/var/lib/mysql

adminer:
image: adminer
ports:
- 9000:8080
- 9000:8080

spring-boot-app:
build:
context: .
dockerfile: Dockerfile
depends_on:
- db
ports:
- 8080:8080
environment:
SPRING_DATASOURCE_URL: jdbc:mysql://db:3306/skilltree
SPRING_DATASOURCE_USERNAME: testuser
SPRING_DATASOURCE_PASSWORD: testpassword
SPRING_JPA_HIBERNATE_DDL_AUTO: update
MYSQL_HOST: db
DB_NAME: skilltree
MYSQL_DB_USERNAME: testuser
MYSQL_DB_PASSWORD: testpassword
DB_DDL_POLICY: update
API_V1_PREFIX: /api/v1
SPRING_DATASOURCE_VERSION: 8.1.0

volumes:
mysql-data:
Loading