Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/favourdaniel/github-actions-with-springboot-and-ec2
This project shows how Github Actions work
https://github.com/favourdaniel/github-actions-with-springboot-and-ec2
aws cicd java springboot
Last synced: 12 days ago
JSON representation
This project shows how Github Actions work
- Host: GitHub
- URL: https://github.com/favourdaniel/github-actions-with-springboot-and-ec2
- Owner: FavourDaniel
- Created: 2022-07-23T09:54:57.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-08-11T16:57:30.000Z (over 2 years ago)
- Last Synced: 2024-12-14T23:31:15.634Z (2 months ago)
- Topics: aws, cicd, java, springboot
- Language: Java
- Homepage:
- Size: 85 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Github-Actions-with-Springboot-and-EC2
This project demonstrates how to create a continuous integration pipeline such that if a change is made to the repository, updates are automatically built and pushed to the ec2 instance.
---
## Pre-requisites & Installation guide
Working knowledge of CICD, aws, a code editor.### Create an EC2 instance
- In your security group inboud rules setting, open ssh for port 22 - custom and open tcp for port 80 - anywhere
- Allocate an elastic IP address to your instance to provide you with a static ip (optional)
###---
# Project Setup
### Step 1: Clone this repository
```
git clone
```
### Step 2: Edit the repo by adding your instance details where expected.### Step 3: ssh into your ec2 instance
```
sudo ssh -i "yourkeypairname.pem" [email protected]
```
If you do not understand the above, the below is an example
```
sudo ssh -i "cicdkey.pem" [email protected]
```
NB: ensure you are in the directory where your key pair is present.### Step 4: Setup Github Actions
Push the project to github and in the settings tab, select Actions >> Runners >> Then create a new self-hosted runner
After creating the self-hosted runner, select the runner image depending on what kind of instance you created, the copy and paste all the commands under ```Download``` to your ec2 instance which you have sshed into
Once you have copied and pasted the ```Download``` commands, copy and past the ```Configure``` commands as well
### Step 5: Further Installations
After setup, some specifics in the project need to be installed for the runner to do its work. If you ```ls``` you would see the files that the runner presently contains.
```
sudo ./svc.sh install
```
After installing in, start it
```
sudo ./svc.sh start
```
This command automatically connects your project with Github/the repo.### Step 5: Setup Workflow
The workflow for this project has already been setup but if you would like to set it up your own, delete the ```maven.yml``` file.
Navigate to actions tab on the in the repository and select ```Java with Maven```.
Inside the workflow, in jobs >> builds >> runs-on, change ```ubuntu-latest``` to ```self-hosted``` because we are using a self-hosted runner. You can take out the ```pull_request: branches``` since it is not necessary, then commit.
### Step 6: Installing dependencies
Jdk needs to be installed in the instance. In the actions-runner directory, ```cd`` and update pacakages first
```
sudo apt update
```
Then
```
sudo apt install maven openjdk-11-jre openjdk-11-jdk
```
With dependencies in place, builds made will run and be visble on githubYou can check your instance ip address to view the site.