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

Reg flow #25

Open
wants to merge 74 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
80e8442
Delete src/main/frontend directory
rtk93 Jun 23, 2023
577def3
Create test.txt
rtk93 Jun 23, 2023
c6ddb5e
Add files via upload
rtk93 Jun 23, 2023
fa0a53a
Delete test.txt
rtk93 Jun 23, 2023
5184db2
Merge pull request #1 from rtk93/feature/ui-raiseneed
Sowmya-Raghuram Jun 23, 2023
68a3045
Need plans component
Manoj-KumarS Jun 29, 2023
3483ae1
added functions
Manoj-KumarS Jun 29, 2023
b4d8801
added header to calendar
vai-mr Jun 30, 2023
b201fe0
Merge pull request #1 from vai-mr/needplans-1.0
Manoj-KumarS Jul 1, 2023
be00b2a
Needplans 2.0
Manoj-KumarS Jul 3, 2023
94267d0
Sidebar1.0
vai-mr Jul 4, 2023
5e2b97c
Added Event Display
vai-mr Jul 5, 2023
60e105c
Merge pull request #2 from vai-mr/needplans-1.0
Manoj-KumarS Jul 5, 2023
ba587ed
Added redux
vai-mr Jul 7, 2023
0c863df
Merge pull request #3 from vai-mr/needplans-1.0
Manoj-KumarS Jul 7, 2023
04deba4
redux and needplans
Manoj-KumarS Jul 9, 2023
4ad3392
Added github actions
sarkararnab Jul 10, 2023
569a7e7
Merge pull request #3 from sarkarnab1/release-ui-1.1.0.0
Sowmya-Raghuram Jul 10, 2023
8907f82
added comments
Manoj-KumarS Jul 11, 2023
b5405f9
Merge pull request #4 from Manoj-KumarS/needplans-1.0
Sowmya-Raghuram Jul 12, 2023
6941af6
Added Docker file
Sowmya-Raghuram Jul 14, 2023
8b12c50
Add files via upload
rtk93 Jul 25, 2023
d9b7c64
Merge pull request #1 from rtk93/rtk93-patch-1
rtk93 Jul 25, 2023
bd84380
Merge pull request #7 from rtk93/release-ui-1.1.0.0
Sowmya-Raghuram Jul 25, 2023
6a0b794
Create .env
sarkarnab1 Jul 25, 2023
ef7c04f
Merge pull request #8 from sarkarnab1/patch-1
Sowmya-Raghuram Jul 25, 2023
1c8c4ce
CSS changes
Manoj-KumarS Jul 30, 2023
2f8483b
Merge branch 'Sunbird-Serve:main' into needplans-1.0
Manoj-KumarS Jul 30, 2023
49278f8
Add files via upload
rtk93 Jul 31, 2023
82531b4
Merge pull request #3 from rtk93/rtk93-patch-1
rtk93 Jul 31, 2023
d03dded
Merge pull request #10 from rtk93/release-ui-1.1.0.0
Sowmya-Raghuram Jul 31, 2023
718a94f
Create .env
sarkarnab1 Jul 31, 2023
796321e
Merge pull request #11 from sarkarnab1/patch-2
Sowmya-Raghuram Jul 31, 2023
275cbe5
Update RaiseNeed.js
rtk93 Aug 4, 2023
521f262
Merge pull request #4 from rtk93/rtk93-patch-2
rtk93 Aug 4, 2023
2a59338
Merge pull request #12 from rtk93/release-ui-1.1.0.0
Sowmya-Raghuram Aug 4, 2023
6416b3f
Add files via upload
rtk93 Aug 10, 2023
699c46e
Merge pull request #5 from rtk93/rtk93-patch-3
rtk93 Aug 10, 2023
199468a
Delete src/main/frontend/src directory
rtk93 Aug 10, 2023
647649c
Add files via upload
rtk93 Aug 10, 2023
bca127d
Merge pull request #15 from rtk93/release-ui-1.1.0.0
Sowmya-Raghuram Aug 10, 2023
8d05e75
Add files via upload
rtk93 Aug 10, 2023
491ced9
Merge pull request #16 from rtk93/release-ui-1.1.0.0
Sowmya-Raghuram Aug 10, 2023
6dd0f88
Add files via upload
rtk93 Aug 18, 2023
f2edaf4
Add files via upload
rtk93 Aug 18, 2023
66ec9a8
Merge pull request #17 from rtk93/release-ui-1.1.0.0
Sowmya-Raghuram Aug 18, 2023
4c4b3df
Add files via upload
rtk93 Aug 21, 2023
357faac
Merge pull request #18 from rtk93/release-ui-1.1.0.0
Sowmya-Raghuram Aug 21, 2023
386b1ee
Add files via upload
rtk93 Aug 24, 2023
d2e6a48
Merge pull request #19 from rtk93/release-ui-1.1.0.0
Sowmya-Raghuram Aug 24, 2023
cc6eef2
Update VolunteerExplore.js - Status of NeedType changed
Sowmya-Raghuram Aug 24, 2023
95cad78
Add files via upload
rtk93 Aug 24, 2023
e537a91
Merge pull request #20 from rtk93/release-ui-1.1.0.0
Sowmya-Raghuram Aug 24, 2023
6bc31ca
Update VolunteerExplore.js - increased need limit
Sowmya-Raghuram Aug 24, 2023
b7e8ec7
Merge branch 'release-ui-1.1.0.0' into needplans-1.0
Sowmya-Raghuram Aug 28, 2023
1508604
Merge pull request #21 from Manoj-KumarS/needplans-1.0
Sowmya-Raghuram Aug 28, 2023
9d66444
reg form added
Manoj-KumarS Aug 29, 2023
2f0c0f8
Add files via upload
rtk93 Aug 29, 2023
f340ebb
Merge pull request #6 from rtk93/rtk93-patch-4
rtk93 Aug 29, 2023
27567ff
Add files via upload
rtk93 Aug 29, 2023
53356da
Add files via upload
rtk93 Aug 29, 2023
32feb44
Merge branch 'release-ui-1.1.0.0' into release-ui-1.1.0.0
Sowmya-Raghuram Aug 30, 2023
d986475
Merge pull request #22 from rtk93/release-ui-1.1.0.0
Sowmya-Raghuram Aug 30, 2023
b3c482c
Add files via upload
rtk93 Aug 30, 2023
d3742f0
Add files via upload
rtk93 Aug 30, 2023
8aec94f
Merge pull request #23 from rtk93/release-ui-1.1.0.0
Sowmya-Raghuram Aug 30, 2023
9a243ac
header, footer, event values
vai-mr Aug 30, 2023
b7b049e
reg form succ and fail screen
vai-mr Aug 30, 2023
d5ff3e3
Merge pull request #4 from vai-mr/registration
Manoj-KumarS Aug 30, 2023
1c18b7d
removed hardcodings
Sowmya-Raghuram Aug 30, 2023
650c21e
Update NeedsTable.js
Sowmya-Raghuram Aug 30, 2023
dd4eb0a
Merge branch 'release-ui-1.1.0.0' into registration
Sowmya-Raghuram Aug 30, 2023
417dfbb
Merge pull request #24 from Manoj-KumarS/registration
Sowmya-Raghuram Aug 30, 2023
6507b54
Combined registration components
Manoj-KumarS Aug 30, 2023
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
Binary file added .DS_Store
Binary file not shown.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test
Binary file added .github/.DS_Store
Binary file not shown.
139 changes: 139 additions & 0 deletions .github/workflows/aws.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
# This workflow will build and push a new container image to Amazon ECR,
# and then will deploy a new task definition to Amazon ECS, when there is a push to the "main" branch.
#
# To use this workflow, you will need to complete the following set-up steps:
#
# 1. Create an ECR repository to store your images.
# For example: `aws ecr create-repository --repository-name my-ecr-repo --region us-east-2`.
# Replace the value of the `ECR_REPOSITORY` environment variable in the workflow below with your repository's name.
# Replace the value of the `AWS_REGION` environment variable in the workflow below with your repository's region.
#
# 2. Create an ECS task definition, an ECS cluster, and an ECS service.
# For example, follow the Getting Started guide on the ECS console:
# https://us-east-2.console.aws.amazon.com/ecs/home?region=us-east-2#/firstRun
# Replace the value of the `ECS_SERVICE` environment variable in the workflow below with the name you set for the Amazon ECS service.
# Replace the value of the `ECS_CLUSTER` environment variable in the workflow below with the name you set for the cluster.
#
# 3. Store your ECS task definition as a JSON file in your repository.
# The format should follow the output of `aws ecs register-task-definition --generate-cli-skeleton`.
# Replace the value of the `ECS_TASK_DEFINITION` environment variable in the workflow below with the path to the JSON file.
# Replace the value of the `CONTAINER_NAME` environment variable in the workflow below with the name of the container
# in the `containerDefinitions` section of the task definition.
#
# 4. Store an IAM user access key in GitHub Actions secrets named `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY`.
# See the documentation for each action used below for the recommended IAM policies for this IAM user,
# and best practices on handling the access key credentials.

name: Deploy to Amazon ECS

on:
push:
branches: [ "release-ui-*" ]
#pull_request:
# The branches below must be a subset of the branches above
#branches: [ "main" ]


env:
AWS_REGION: ap-south-1 # set this to your preferred AWS region, e.g. us-west-1
ECR_REPOSITORY: sunbird-serve-ui # set this to your Amazon ECR repository name
ECS_SERVICE: sunbird-serve-ui # set this to your Amazon ECS service name
ECS_CLUSTER: ecs-integrated # set this to your Amazon ECS cluster name
ECS_TASK_DEFINITION: .github/workflows/task-definition.json # set this to the path to your Amazon ECS task definition
# file, e.g. .aws/task-definition.json
CONTAINER_NAME: sunbird-serve-ui # set this to the name of the container in the
# containerDefinitions section of your task definition
SHELL_SCRIPT_NAME: .github/workflows/create-json.sh
PYTHON_FILE_NAME: .github/workflows/replace-secrets.py

permissions:
contents: read
id-token: write

jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
environment: production

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

- name: Shell script to create JSON
run: ${{ env.SHELL_SCRIPT_NAME }}
shell: bash

- name: Dump older task definition
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
run: |
aws ecs describe-task-definition --region ap-south-1 --task-definition sunbird-serve-ui --query taskDefinition > .github/workflows/task-definition.json
cat .github/workflows/task-definition.json
ls -ltr
pwd
tree
cd .github/workflows
ls -ltr
pwd
tree

- name: Python to update TD
run: python ${{ env.PYTHON_FILE_NAME }}


- name: Print new task definition
run: |
cat .github/workflows/task-definition.json

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}

#- name: register_ecs_td.sh
#run: |
#bash register_ecs_td.sh ${{ steps.build-image.outputs.image }}
#cat .github/workflows/task-definition.json

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1

- name: Build, tag, and push image to Amazon ECR
id: build-image
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
IMAGE_TAG: ${{ github.sha }}
run: |
# Build a docker container and
# push it to ECR so that it can
# be deployed to ECS.
cd src/main/frontend
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
echo "image=$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" >> $GITHUB_OUTPUT
- name: Fill in the new image ID in the Amazon ECS task definition
id: task-def
uses: aws-actions/amazon-ecs-render-task-definition@v1
with:
task-definition: ${{ env.ECS_TASK_DEFINITION }}
container-name: ${{ env.CONTAINER_NAME }}
image: ${{ steps.build-image.outputs.image }}

- name: Deploy Amazon ECS task definition
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
with:
task-definition: ${{ steps.task-def.outputs.task-definition }}
service: ${{ env.ECS_SERVICE }}
cluster: ${{ env.ECS_CLUSTER }}
wait-for-service-stability: false


#- name: redeploy with newly created service after bash script
#run: |
# redeploying
#ls
25 changes: 25 additions & 0 deletions .github/workflows/create-json.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#/bin/bash
account_id=049302583731
if [ -f /tmp/__secrets.json ] ; then
rm -f /tmp/__secrets.json
fi

printf '{
"secrets": [' > /tmp/__secrets.json

for line in `cat .env`
do
key=$line
if [[ -z "$line" || "$line" =~ ^[[:space:]]*# ]]; then
continue
fi
echo "{
"'"name"'": "'"'$key'"'",
"'"valueFrom"'": "'"'"arn:aws:ssm:ap-south-1:$account_id:parameter/$key"'"'"
}," >> /tmp/__secrets.json
done
sed '$ s/,$//' /tmp/__secrets.json > .github/workflows/secrets.json

echo ']}' >> .github/workflows/secrets.json

cat .github/workflows/secrets.json
45 changes: 45 additions & 0 deletions .github/workflows/replace-secrets.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import json

original_taskdef = ".github/workflows/task-definition.json"
secrets_array = ".github/workflows/secrets.json"


with open(original_taskdef, 'r') as file:
task_definition = json.load(file)

for item in task_definition:
if "containerDefinitions" in item:
containerDefinitions = task_definition['containerDefinitions']
for item in containerDefinitions:
if "secrets" in item:
print("secret block exists")
#print(json.dumps(containerDefinitions[0]['secrets'], indent=4)) # if want to print



with open(secrets_array, 'r') as new_file:
new_data = json.load(new_file)
new_secrets = new_data['secrets']
#print(json.dumps(new_secrets, indent=4))

#__task_definition = task_definition["taskDefinition"]
#__secrets_to_replace = __task_definition["containerDefinitions"]
#secrets_to_replace = __secrets_to_replace[0]["secrets"]
#__secrets_to_replace[0]["secrets"] = new_secrets


__secrets_to_replace = task_definition['containerDefinitions']
secrets_to_replace = __secrets_to_replace[0]['secrets']
__secrets_to_replace[0]['secrets'] = new_secrets

#task_definition['secrets'] = new_secrets #replace old secrets block with new_secrets


print(json.dumps(task_definition, indent = 4))


# writing to new file
with open(".github/workflows/task-definition.json", 'w') as outfile:
json.dump(task_definition, outfile, indent=4)

print("Updated JSON has been written to new_task_definition.json file.")
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
src/main/frontend/node_modules
1 change: 1 addition & 0 deletions src/main/frontend/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test
2 changes: 1 addition & 1 deletion src/main/frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ COPY package-lock.json .
RUN npm install ci --only=production
COPY . .
EXPOSE 3000
CMD ["npm","start"]
CMD ["npm","start"]
Loading