-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #44 from Map-Pin/dev
Dev
- Loading branch information
Showing
30 changed files
with
542 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,9 +31,10 @@ jobs: | |
run: | | ||
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} | ||
docker build -t ${{ secrets.DOCKER_REPO }}/mappin-server . | ||
docker push ${{ secrets.DOCKER_REPO }}/mappin-server | ||
docker build -t ${{ secrets.DOCKER_REPO }}/mappin-nginx . | ||
docker push ${{ secrets.DOCKER_REPO }}/mappin-nginx | ||
docker push ${{ secrets.DOCKER_REPO }}/mappin-server | ||
docker build -t ${{ secrets.DOCKER_REPO }}/mappin-nginx -f dockerfile-nginx . | ||
docker push ${{ secrets.DOCKER_REPO }}/mappin-nginx | ||
- name: Install Docker on EC2 | ||
uses: appleboy/[email protected] | ||
|
@@ -67,10 +68,10 @@ jobs: | |
script: | | ||
if [ "$(sudo docker ps -aq)" ]; then | ||
sudo docker stop $(sudo docker ps -aq) | ||
sudo docker rm $(sudo docker ps -aq) | ||
sudo docker rm -f $(sudo docker ps -aq) | ||
fi | ||
if [ "$(sudo docker images -aq)" ]; then | ||
sudo docker rmi $(sudo docker images -aq) | ||
sudo docker rmi -f $(sudo docker images -aq) | ||
fi | ||
- name: Copy file to EC2 | ||
|
@@ -96,6 +97,9 @@ jobs: | |
echo "JWT_SECRET=${{ secrets.JWT_SECRET }}" >> ~/.env | ||
echo "KAKAO_CLIENT=${{ secrets.KAKAO_CLIENT }}" >> ~/.env | ||
echo "KAKAO_SECRET=${{ secrets.KAKAO_SECRET }}" >> ~/.env | ||
echo "KAKAO_REST_API_KEY=${{ secrets.KAKAO_REST_API_KEY }}" >> ~/.env | ||
echo "S3accessKey=${{ secrets.S3ACCESSKEY }}" >> ~/.env | ||
echo "S3SecretKey=${{ secrets.S3SECRETKEY }}" >> ~/.env | ||
# Copy .env file to the project directory | ||
#cp ~/.env /home/ubuntu/.env | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
FROM nginx | ||
COPY ./nginx/conf.d/nginx.conf /etc/nginx/conf.d | ||
CMD ["nginx" ,"-g", "daemon off;"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.server.mappin.config; | ||
|
||
import com.amazonaws.auth.AWSStaticCredentialsProvider; | ||
import com.amazonaws.auth.BasicAWSCredentials; | ||
import com.amazonaws.services.s3.AmazonS3Client; | ||
import com.amazonaws.services.s3.AmazonS3ClientBuilder; | ||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
@Configuration | ||
public class S3Config { | ||
|
||
@Value("${cloud.aws.credentials.access-key}") | ||
private String accessKey; | ||
|
||
@Value("${cloud.aws.credentials.secret-key}") | ||
private String secretKey; | ||
|
||
@Value("${cloud.aws.region.static}") | ||
private String region; | ||
|
||
@Bean | ||
public AmazonS3Client amazonS3Client() { | ||
BasicAWSCredentials awsCreds = new BasicAWSCredentials(accessKey, secretKey); | ||
return (AmazonS3Client) AmazonS3ClientBuilder.standard() | ||
.withRegion(region) | ||
.withCredentials(new AWSStaticCredentialsProvider(awsCreds)) | ||
.build(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
src/main/java/com/server/mappin/controller/S3Controller.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.server.mappin.controller; | ||
|
||
import com.server.mappin.service.S3Service; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.web.bind.annotation.*; | ||
import org.springframework.web.multipart.MultipartFile; | ||
|
||
import java.io.IOException; | ||
|
||
@RequiredArgsConstructor | ||
@RequestMapping(value = "aws-s3") | ||
@RestController | ||
public class S3Controller { | ||
|
||
private final S3Service s3UploadUtil; | ||
|
||
@PostMapping(name = "S3 파일 업로드", value = "/file") | ||
public String fileUpload(@RequestParam("files") MultipartFile multipartFile) throws IOException { | ||
s3UploadUtil.upload(multipartFile, "test"); // test 폴더에 파일 생성 | ||
return "success"; | ||
} | ||
|
||
@DeleteMapping(name = "S3 파일 삭제", value = "/file") | ||
public String fileDelete(@RequestParam("path") String path) { | ||
s3UploadUtil.delete(path); | ||
return "success"; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ | |
@Entity | ||
@Table(name = "location") | ||
@NoArgsConstructor | ||
@Getter | ||
public class Location { | ||
|
||
@Id | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
src/main/java/com/server/mappin/dto/AdminLoginResponseDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package com.server.mappin.dto; | ||
|
||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.Getter; | ||
import org.springframework.data.geo.Point; | ||
|
||
@Data | ||
@Builder | ||
@Getter | ||
public class AdminLoginResponseDto implements LoginResponseDto { | ||
private int statusCode; | ||
private String isSuccess; | ||
private Long id; | ||
private String role; | ||
private String jwt; | ||
private String token_type; | ||
private long expires_in; | ||
private Point geo; | ||
|
||
@Override | ||
public int getStatusCode(){ | ||
return statusCode; | ||
} | ||
@Override | ||
public String getIsSuccess() { | ||
return isSuccess; | ||
} | ||
|
||
@Override | ||
public Long getId() { | ||
return id; | ||
} | ||
|
||
@Override | ||
public String getRole() { | ||
return role; | ||
} | ||
|
||
@Override | ||
public String getJwt() { | ||
return jwt; | ||
} | ||
|
||
@Override | ||
public String getToken_Type() { | ||
return token_type; | ||
} | ||
|
||
@Override | ||
public long getExpires_In() { | ||
return expires_in; | ||
} | ||
|
||
} |
14 changes: 14 additions & 0 deletions
14
src/main/java/com/server/mappin/dto/FindByCategoryListResponseDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.server.mappin.dto; | ||
|
||
import lombok.Builder; | ||
import lombok.Data; | ||
|
||
import java.util.List; | ||
|
||
@Builder | ||
@Data | ||
public class FindByCategoryListResponseDto { | ||
private int statusCode; | ||
private String isSuccess; | ||
private List<FindByCategoryResponseDto> losts; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
src/main/java/com/server/mappin/dto/FindByDongResponseDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.server.mappin.dto; | ||
|
||
import lombok.Builder; | ||
import lombok.Data; | ||
import java.time.LocalDateTime; | ||
|
||
@Data | ||
@Builder | ||
public class FindByDongResponseDto { | ||
private Long id; | ||
private String title; | ||
private LocalDateTime createdAt; | ||
private String imageUrl; | ||
private String dong; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,11 @@ | ||
package com.server.mappin.dto; | ||
|
||
import lombok.Builder; | ||
import lombok.Data; | ||
|
||
@Data | ||
@Builder | ||
public class LoginResponseDto { | ||
private String isSuccess; | ||
private Long id; | ||
private String jwt; | ||
private String token_type; | ||
private long expires_in; | ||
public interface LoginResponseDto { | ||
int getStatusCode(); | ||
String getIsSuccess(); | ||
Long getId(); | ||
String getRole(); | ||
String getJwt(); | ||
String getToken_Type(); | ||
long getExpires_In(); | ||
} |
Oops, something went wrong.