Skip to content

Commit

Permalink
fix: fixning error in dirS3Sync app
Browse files Browse the repository at this point in the history
  • Loading branch information
dager-mohamed committed Aug 13, 2024
1 parent bae222e commit 50fec10
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 20 deletions.
15 changes: 6 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,17 @@

- Install packages <br/>
```npm install```
- Make sure docker & docker-compose installed

## Setup

- Copy the `.env.example` file and replace the filename with `.env`.

- Setup an AWS account:
1. Fill in the aws crednetials inside the env file.
2. Create an S3 bucket.
2. Create an S3 bucket then fill the bucket name inside the .env file.
3. Create a cloudfront distribution.
4. IMPORTANT: if this error occured (`Your account must be verified before you can add new CloudFront resources`) while create a cloudfront distribution, please see [this](https://maxrohde.com/2022/06/10/solving-error-creating-cloudfront-distribution-accessdenied-your-account-must-be-verified/).
- Run the backend app in development mode <br/>
```npm run dev:backend```
- Run the frontend app in development mode <br/>
```npm run dev:web```
- Run the RTMP Server & HLS transcoder [important]: <br/>
1. ```docker-compose build``` <br/>
2. ```docker-compose up```
4. IMPORTANT: if this error occured (`Your account must be verified before you can add new CloudFront resources`) while creating a cloudfront distribution, please see [this](https://maxrohde.com/2022/06/10/solving-error-creating-cloudfront-distribution-accessdenied-your-account-must-be-verified/).
- Run ```npm run dev```
- Run the RTMP Server, HLS transcoder and the S3 directory sync [important]: <br/>
- ```npm run docker```
2 changes: 1 addition & 1 deletion apps/dirS3Sync/src/utils/aws/deleteFromS3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ export function deleteFromS3(filePath: string) {
Key: path.basename(filePath),
})
)
.catch((err) => console.log(err));
.catch((err) => console.error(err));
}
10 changes: 1 addition & 9 deletions apps/dirS3Sync/src/utils/aws/uploadToS3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,6 @@ export function uploadToS3(filePath: string) {

const fileContent = fs.readFileSync(filePath);

awsS3Client
.send(
new CreateBucketCommand({
Bucket: process.env.AWS_S3_BUCKET,
})
)
.catch((err) => console.log(err));

awsS3Client
.send(
new PutObjectCommand({
Expand All @@ -25,5 +17,5 @@ export function uploadToS3(filePath: string) {
Body: fileContent,
})
)
.catch((err) => console.log(err));
.catch((err) => console.error(err));
}
74 changes: 74 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
"scripts": {
"dev:web": "npx nx run web:dev",
"dev:backend": "npx nx serve backend",
"dev:watcher": "npx nx run dirS3Sync:serve"
"dev:watcher": "npx nx run dirS3Sync:serve",
"dev": "concurrently \"npm run dev:web\" \"npm run dev:backend\" \"npm run dev:watcher\"",
"docker": "docker-compose up --build"
},
"private": true,
"dependencies": {
Expand Down Expand Up @@ -63,6 +65,7 @@
"@typescript-eslint/parser": "^7.16.0",
"autoprefixer": "10.4.13",
"babel-jest": "^29.4.1",
"concurrently": "^8.2.2",
"esbuild": "^0.19.2",
"eslint": "~8.57.0",
"eslint-config-next": "14.2.3",
Expand Down

0 comments on commit 50fec10

Please sign in to comment.