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

Mansunproject #237

Draft
wants to merge 107 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
107 commits
Select commit Hold shift + click to select a range
dcf2741
ci: add cicd
DeepakBomjan Feb 20, 2024
c784b78
fix syntax
DeepakBomjan Feb 20, 2024
9d65728
debug
DeepakBomjan Feb 20, 2024
49bac07
debug
DeepakBomjan Feb 20, 2024
c78b207
debug
DeepakBomjan Feb 20, 2024
7adaf81
TEST
sarunsarun Feb 20, 2024
fc0027e
ci: make environmetn dynamic
DeepakBomjan Feb 21, 2024
98a74b1
ci: build docker images
DeepakBomjan Feb 21, 2024
08befb6
fix build error
DeepakBomjan Feb 21, 2024
2faf55a
debug
DeepakBomjan Feb 21, 2024
710bca7
debug
DeepakBomjan Feb 21, 2024
4e30bd2
fix variable resolution issue
DeepakBomjan Feb 21, 2024
787acb7
fix
DeepakBomjan Feb 21, 2024
e1a7d3b
fixed file
luminous42 Feb 21, 2024
09ad994
ci : create ec2 instance
luminous42 Feb 23, 2024
c6a350f
userdata updated
sarunsarun Feb 23, 2024
4e80413
ci: deploy
luminous42 Feb 23, 2024
f9f5776
fix lint
luminous42 Feb 23, 2024
953183a
ec2 instance condition
luminous42 Feb 23, 2024
64ec695
aws credentials in deploy job
luminous42 Feb 23, 2024
58d1f7c
Update deploy.yaml
sarunsarun Feb 23, 2024
20b9e69
added deploy.sh
luminous42 Feb 23, 2024
f6b0d78
bash deploy.sh
luminous42 Feb 23, 2024
d6a59be
create lab machine workflow
luminous42 Feb 24, 2024
53ec56b
Merge branch 'hol/luminous' of https://github.com/devops930-broadway/…
luminous42 Feb 24, 2024
c109af6
ci: fix workflow input
luminous42 Feb 24, 2024
4514d4a
ci: workflow input
luminous42 Feb 24, 2024
74eb2d3
Add workflow
ASHUTOSHKHAREL Feb 24, 2024
0f4ed1a
ci: fix
luminous42 Feb 25, 2024
c880faf
Final update
sarunsarun Feb 25, 2024
0b9ae61
changed to expect
luminous42 Feb 25, 2024
b0636f1
Update deploy.yaml
sarunsarun Feb 25, 2024
f5bd1a2
expect
sarunsarun Feb 25, 2024
7c2b957
Update deploy.yaml
sarunsarun Feb 25, 2024
71f03db
Merge branch 'Sarun-deploy' of https://github.com/devops930-broadway/…
sarunsarun Feb 25, 2024
42105dd
Create deploy.sh
sarunsarun Feb 25, 2024
344763a
Merge branch 'Sarun-deploy' of https://github.com/devops930-broadway/…
sarunsarun Feb 25, 2024
13b042b
expect file added
sarunsarun Feb 25, 2024
9e92e14
set -e
luminous42 Feb 25, 2024
1c9ecfa
bash ce updated
sarunsarun Feb 25, 2024
261d439
tag changes
sarunsarun Feb 25, 2024
993e4d8
ci: change machine
luminous42 Feb 25, 2024
79e4a53
ci: new machine
luminous42 Feb 25, 2024
1db0884
Update deploy.yaml
luminous42 Feb 25, 2024
03b92ab
ci: fix
luminous42 Feb 25, 2024
f0d4132
Merge branch 'hol/luminous' of https://github.com/devops930-broadway/…
luminous42 Feb 25, 2024
3ae8945
change sleep time
luminous42 Feb 25, 2024
772598b
ci : change
luminous42 Feb 25, 2024
0736db0
ci: debug
luminous42 Feb 25, 2024
1b0a72f
ci : debugging
luminous42 Feb 25, 2024
5b57a68
ci : change tag
luminous42 Feb 25, 2024
802fb23
ci :change
luminous42 Feb 25, 2024
367848a
deleted
luminous42 Feb 25, 2024
4e72c74
Merge branch 'Sarun-deploy' into hol/luminous
luminous42 Feb 25, 2024
40de72c
ci : new_try
luminous42 Feb 25, 2024
0d50b51
ci : debug
luminous42 Feb 25, 2024
8458b70
Update deploy.yaml
sarunsarun Feb 26, 2024
7e93929
manual trigger workflow
luminous42 Feb 26, 2024
c68875e
Update main.tf
sarunsarun Feb 26, 2024
6d2a05a
userdata.sh
sarunsarun Feb 26, 2024
e3a2ee7
Merge pull request #3 from devops930-broadway/hol/luminous
luminous42 Feb 26, 2024
97ee730
create lab
sarunsarun Feb 26, 2024
2970b5a
Update create_lab.yaml
sarunsarun Feb 26, 2024
4836b15
Update create_machine.yaml
luminous42 Feb 26, 2024
4e74725
Merge pull request #6 from devops930-broadway/luminous42-patch-1
luminous42 Feb 26, 2024
2e9e4e2
lab machine name changes
sarunsarun Feb 26, 2024
2c09b2d
Update create_lab.yaml
DeepakBomjan Feb 26, 2024
531a420
Update create_lab.yaml
DeepakBomjan Feb 26, 2024
21e7496
cretae file name changed
sarunsarun Feb 26, 2024
5e0bfca
Update sarunlab.yaml
sarunsarun Feb 26, 2024
f1cc985
name chnaged
sarunsarun Feb 26, 2024
1df05b5
ansible file updated
sarunsarun Feb 28, 2024
ce21b2f
Update create_machine.yaml
sarunsarun Feb 28, 2024
0b59fa4
Update create_machine.yaml
sarunsarun Feb 28, 2024
a835bbb
Update create_machine.yaml
sarunsarun Feb 28, 2024
a2841df
expect updated for file permission
sarunsarun Feb 28, 2024
64a7a3a
Update install_gitlab.sh
sarunsarun Feb 28, 2024
c40dccb
Update install_gitlab.sh
sarunsarun Feb 28, 2024
8bad9cf
Update install_gitlab.sh
sarunsarun Feb 28, 2024
4d8b905
Update install_gitlab.sh
sarunsarun Feb 28, 2024
a494eb9
ansible file uploaded for gcp
sarunsarun Mar 4, 2024
6dfd054
updated
sarunsarun Mar 4, 2024
a509f6d
Merge branch 'master' into Sarun-deploy
DeepakBomjan Mar 4, 2024
b8630b8
Merge pull request #8 from devops930-broadway/Sarun-deploy
DeepakBomjan Mar 4, 2024
29b9fb3
ok
mansunsilwal77 May 4, 2024
1d4eeac
Update README.md
mansunsilwal77 May 4, 2024
7ced245
Update deploy.yaml
mansunsilwal77 May 4, 2024
546ba66
Update deploy.yaml
mansunsilwal77 May 4, 2024
ceaa7ca
Update deploy.yaml
mansunsilwal77 May 4, 2024
357851c
ok
mansunsilwal77 May 7, 2024
5996856
update
mansunsilwal77 May 7, 2024
8e1c125
yyy
mansunsilwal77 May 7, 2024
d66e234
Update frontend.yml
mansunsilwal77 May 7, 2024
f8be0d9
Update deploy.yaml
mansunsilwal77 May 7, 2024
701be46
up
mansunsilwal77 May 7, 2024
7ed67b3
Update frontend.yml
mansunsilwal77 May 7, 2024
89d5fc2
hatako
mansunsilwal77 May 8, 2024
8dbf8e2
ok
mansunsilwal77 May 13, 2024
fe6486e
Update create_machine.yaml
sarunsarun May 13, 2024
73d7e64
update main.tf
mansunsilwal77 May 13, 2024
6f35226
ok
mansunsilwal77 May 13, 2024
ebd76e7
update
mansunsilwal77 May 13, 2024
76c4972
gg
mansunsilwal77 May 13, 2024
27530e9
Update README.md
sarunsarun May 14, 2024
e3f6ad5
Update README.md
sarunsarun May 14, 2024
3c792b8
repo name
mansunsilwal77 May 15, 2024
6fc23b3
Merge branch 'mansunproject' of https://github.com/devops930-broadway…
mansunsilwal77 May 15, 2024
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
24 changes: 24 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
**/.classpath
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/*.*proj.user
**/*.dbmdl
**/*.jfm
**/bin
**/charts
**/docker-compose*
**/compose*
**/Dockerfile*
**/node_modules
**/npm-debug.log
**/obj
**/secrets.dev.yaml
**/values.dev.yaml
README.md
2 changes: 2 additions & 0 deletions .github/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.terraform*

Binary file added .github/.gitignore.swp
Binary file not shown.
6 changes: 6 additions & 0 deletions .github/Ansible/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
- hosts: localhost
become: yes
vars_files:
- vars/main.yml
roles:
- { role: geerlingguy.gitlab }
25 changes: 25 additions & 0 deletions .github/Ansible/roles/playbook.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
- name: Install GitLab or Jenkins
hosts: all
become: true

vars_files:
- vars/main.yml

vars:
jenkins_hostname: jenkins.example.com
java_packages:
- openjdk-11-jdk

roles:
- name: Install Java
when: server == 'jenkins'
role: geerlingguy.java

- name: Install Jenkins
when: server == 'jenkins'
role: geerlingguy.jenkins

- name: Install GitLab
when: server == 'gitlab'
role: geerlingguy.gitlab
1 change: 1 addition & 0 deletions .github/Ansible/vars/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
gitlab_external_url: "https://gitlab.example.com/"
24 changes: 24 additions & 0 deletions .github/IaC/gcp/cloud-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#cloud-config
# Create a group
groups:
- ubuntu

# Create users, in addition to the users provided by default
users:
- default
- name: ubuntu
gecos: ubuntu
shell: /bin/bash
primary_group: ubuntu
sudo: ALL=(ALL) NOPASSWD:ALL
groups: users, admin
lock_passwd: false
ssh_authorized_keys:
- "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDWv68zjy6/jE7hZzOYmENpVXpFOONlgO+TGRNmepBOEVwpy+KBHxmNU3mNiu6L2f6XX0hQ0KH5MrBR30/Udl8+82by+UG1Nrksa1tinIgDipvkIforn/IabLCee9QLdf5D9lDC94sJkOSF99Pkus4Q+nNqzfp8l5TEGbyT61bx2fsz7adL1oLBOxi/fwfDValSnPjZlglckL/PvWT3kLiVgw6X16XTw3M5k6UJ78coHLG7CTG02WLzVXdwkk7PBfTzj6IRO7WAE8MflP0Jfh57mUHr5sWteJf0prA9PLsNpUK8aGUCI0WhO+bvcweFKJQDeBrlNIxD7LSfGdT8e4tj3d0/qSWc0ZrXteoLZqYI2FT7jWf8G/G0pTVSTlaoioZ5ioZ6OIvC1+gUEf2X5iNFZBoAUtwadHTmJAAuBlWXbYwh6qOUgaGKtoC6f2LioKCK8f0M+di/2cZI05/h9A5R2hsOGu7nuFh8jBWKd85woDFqOoxNlN8N85hp+9UrYV8= gitlab_access" # an SSH public key that is authorized
# to connect to this account
# Run a few commands (update apt's repo indexes and install curl)
runcmd:
- sudo apt-get update
- sudo apt install curl -q -y
- echo "Done"
# - echo "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDWv68zjy6/jE7hZzOYmENpVXpFOONlgO+TGRNmepBOEVwpy+KBHxmNU3mNiu6L2f6XX0hQ0KH5MrBR30/Udl8+82by+UG1Nrksa1tinIgDipvkIforn/IabLCee9QLdf5D9lDC94sJkOSF99Pkus4Q+nNqzfp8l5TEGbyT61bx2fsz7adL1oLBOxi/fwfDValSnPjZlglckL/PvWT3kLiVgw6X16XTw3M5k6UJ78coHLG7CTG02WLzVXdwkk7PBfTzj6IRO7WAE8MflP0Jfh57mUHr5sWteJf0prA9PLsNpUK8aGUCI0WhO+bvcweFKJQDeBrlNIxD7LSfGdT8e4tj3d0/qSWc0ZrXteoLZqYI2FT7jWf8G/G0pTVSTlaoioZ5ioZ6OIvC1+gUEf2X5iNFZBoAUtwadHTmJAAuBlWXbYwh6qOUgaGKtoC6f2LioKCK8f0M+di/2cZI05/h9A5R2hsOGu7nuFh8jBWKd85woDFqOoxNlN8N85hp+9UrYV8= gitlab_access" > /home/ubuntu/.ssh/authorized_keys
69 changes: 69 additions & 0 deletions .github/IaC/gcp/gcp-compute.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
provider "google" {
credentials = file("gcp_accesskey.json")
project = local.gcp_accesskey.project_id
region = "us-central1"
}

locals {
gcp_accesskey = jsondecode(file("gcp_accesskey.json"))
}

variable "branch_name" {
type = string

}

variable "server" {
type = string
default = "compute"

}



resource "google_compute_instance" "lab-machine" {
name = "gitlab-node-${var.branch_name}"
machine_type = "custom-2-6400"

zone = "us-central1-a"

metadata = {
# ssh-keys = "cloud_user_p_59cf731f:${file("./aleo_test_gcp_rsa.pub")}"
user-data = file("${path.module}/cloud-config.yaml")
}


boot_disk {
initialize_params {
image = "ubuntu-os-cloud/ubuntu-2204-lts"
size = 50
}
}

# metadata_startup_script = file("./startup.sh")
metadata_startup_script = templatefile("${path.module}/startup.sh.tpl", { server = var.server })
network_interface {
network = "default"

access_config {
// Optional: Ephemeral IP
}
}
}

# Define the firewall rule to allow all incoming traffic
resource "google_compute_firewall" "lab_machine_firewall" {
name = "allow-all"
network = "default"

allow {
protocol = "all"
}

source_ranges = ["0.0.0.0/0"] # Allow traffic from any source (all IPs)
}


output "public_ip" {
value = google_compute_instance.lab-machine.network_interface[0].access_config[0].nat_ip
}
60 changes: 60 additions & 0 deletions .github/IaC/gcp/startup.sh.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#!/bin/bash

echo "Server: ${server}" >/tmp/hello.log

if [ -z "$service" ]; then
echo "Usage: $0 <service>"
echo "Please provide the service name: gitlab or jenkins"
exit 1
fi

## Create Ansible project
cd ~
mkdir -p ansible_${server}/vars
echo "localhost" > ansible_${server}/hosts
cat > "ansible_${server}/$file_path" << EOF
---
- name: Install GitLab or Jenkins
hosts: all
become: true

vars_files:
- vars/main.yml

vars:
jenkins_hostname: jenkins.example.com
java_packages:
- openjdk-11-jdk

roles:
- name: Install Java
when: server == 'jenkins'
role: geerlingguy.java

- name: Install Jenkins
when: server == 'jenkins'
role: geerlingguy.jenkins

- name: Install GitLab
when: server == 'gitlab'
role: geerlingguy.gitlab
EOF

echo "YAML content has been written to $file_path"

case "$service" in
gitlab)
echo "Starting GitLab..."
ansible-playbook -i inventory.yml playbook.yml -e "server=gitlab"

;;
jenkins)
echo "Starting Jenkins..."
ansible-playbook -i inventory.yml playbook.yml -e "server=jenkins"
;;
*)
echo "Unknown service: $service"
echo "Please provide either 'gitlab' or 'jenkins'"
exit 1
;;
esac
29 changes: 29 additions & 0 deletions .github/IaC/terraform/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
locals {
example = "mern-ecs-terraform"
}

provider "aws" {
region = "us-east-1"

default_tags {
tags = { example = local.example,
Environment = "devlopment",
Project = "devopslab" }
}
}


module "cloudfront_s3_website_with_domain" {
source = "../modules/terraform-aws-cloudfront-s3-website"
tags = var.tags
domain_name = "devops630.example.com"
cloudfront_min_ttl = 10
cloudfront_default_ttl = 1400
cloudfront_max_ttl = 86400
}

output "cloudfront_domain_name" {
value = "https://${module.cloudfront_s3_website_with_domain.cloudfront_domain_name}"
}


Loading