Skip to content

Setup an automated cloud deployment using Heroku/AWS #11

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

Open
GouravRusiya30 opened this issue Jul 20, 2020 · 6 comments
Open

Setup an automated cloud deployment using Heroku/AWS #11

GouravRusiya30 opened this issue Jul 20, 2020 · 6 comments
Labels
enhancement :octocat: New feature or request is welcome good first issue Good for newcomers help wanted Extra attention is needed

Comments

@GouravRusiya30
Copy link
Owner

GouravRusiya30 commented Jul 20, 2020

Cloud deployment

  • Setup an automated cloud deployment using Heroku/AWS etc; [Anything on which you are comfortable].

  • This will complete the template to re-use as it is for anyone who are looking for a Spring Boot Rest API microservice fully Continuous Integrated with Code-Coverage, JWT and Cloud Deployable.

@GouravRusiya30 GouravRusiya30 added help wanted Extra attention is needed good first issue Good for newcomers enhancement :octocat: New feature or request is welcome labels Jul 20, 2020
@GouravRusiya30 GouravRusiya30 pinned this issue Jul 20, 2020
@GouravRusiya30 GouravRusiya30 changed the title Cloud deployment Setup an automated cloud deployment using Heroku/AWS Jul 23, 2020
@ghost
Copy link

ghost commented Mar 31, 2022

Hey, still needs to be done? I can help with it since it's a really interesting project.

I’m thinking about a deployment script with some flags available to pass credentials and the target cloud service, would it be good? Maybe a python script to make it really cross platform.

Let me know, cheers!

@GouravRusiya30
Copy link
Owner Author

Hello @raccodee,

Thanks for showing interest, yes it's still open.
You can go ahead and start working on it.

  • Create a fresh new branch for this change and make sure write appropriate README
  • If we want to discuss then we can schedule a meet. Let me know.

Apologies for the late response :)

@sujeet-dev-io
Copy link

GitHub Actions (Heroku)

name: Deploy to Heroku

on:
push:
branches:
- main # Change if needed

jobs:
deploy:
runs-on: ubuntu-latest

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

  - name: Set up JDK 17
    uses: actions/setup-java@v3
    with:
      distribution: 'temurin'
      java-version: '17'

  - name: Build with Maven
    run: mvn clean package

  - name: Deploy to Heroku
    uses: akhileshns/[email protected]
    with:
      heroku_api_key: ${{ secrets.HEROKU_API_KEY }}
      heroku_app_name: "your-heroku-app-name"
      heroku_email: "[email protected]"

    👉 Steps Explanation:   Builds the project using Maven. 2. Deploys the application to Heroku using GitHub Actions.

Step 2: Enable JWT Authentication in Spring Boot

io.jsonwebtoken jjwt 0.11.5 org.springframework.boot spring-boot-starter-security

Implement JWT Utils:
@component
public class JwtUtil {
private final String SECRET_KEY = "your-secret-key";

public String generateToken(String username) {
    return Jwts.builder()
            .setSubject(username)
            .setIssuedAt(new Date())
            .setExpiration(new Date(System.currentTimeMillis() + 1000 * 60 * 60))
            .signWith(Keys.hmacShaKeyFor(SECRET_KEY.getBytes()), SignatureAlgorithm.HS256)
            .compact();
}

public boolean validateToken(String token) {
    try {
        Jwts.parserBuilder().setSigningKey(SECRET_KEY.getBytes()).build().parseClaimsJws(token);
        return true;
    } catch (Exception e) {
        return false;
    }
}

}

@GouravRusiya30
Copy link
Owner Author

@sujeet-dev-io Thanks for attempting this open issue.
Can you please test & verify your changes ?
Also please create pull request for your changes.

Open questions:

  • How will we maintain the credentials since we can't place them in the code.
  • Also let's use latest version of java everywhere in the code hence make those changes as part of this change.
  • Add verification details of local testing.

Thanks again for this, really appreciate the help !!!

@sujeet-dev-io
Copy link

@GouravRusiya30 I want to ask , Are you currently working professional?
What are you used Maven or Gradle?

@GouravRusiya30
Copy link
Owner Author

@sujeet-dev-io Please stick to questions related to this project. If you are interested to pick this issue then fine else ignore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement :octocat: New feature or request is welcome good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants