Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
a75299e
deploy all component on vm
rajeevranjan123 Sep 8, 2021
cfd7fb5
3 instance for load testing of ui tier
rajeevranjan123 Sep 8, 2021
faee455
deploy all comps in one vm
rajeevranjan123 Sep 8, 2021
8c0793e
deploy all changes in one vm
rajeevranjan123 Sep 8, 2021
b82443f
All deployment changes in one VM
rajeevranjan123 Sep 10, 2021
24ff3fb
all deployment in one vm
rajeevranjan123 Sep 10, 2021
c6f1f20
updated promotions applications
rajeevranjan123 Sep 17, 2021
0918594
updated region
rajeevranjan123 Sep 17, 2021
8c5fc94
Added sample yaml file
rajeevranjan123 Sep 17, 2021
35f3c6e
added new blueprint
Sep 17, 2021
786cc91
added new test.py
Sep 17, 2021
4aad2bf
added requirement files
Sep 17, 2021
9e1ac98
added new wordpress project
Sep 19, 2021
586e82a
added new img for wordpress
Sep 19, 2021
256f7e1
added new sql for wordpress
Sep 19, 2021
250954f
update region
Sep 20, 2021
8c48f16
update region
Sep 20, 2021
7dd72b6
update region
Sep 20, 2021
6aae668
update instance
Sep 20, 2021
c22b9d6
update instance
Sep 20, 2021
059b3ea
update instance
Sep 20, 2021
911ce55
updated application script
Sep 20, 2021
e6514fe
added sample api script
Sep 20, 2021
d054993
added sample api script
Sep 20, 2021
111f997
added health chk
Sep 20, 2021
3b9a637
added region
Sep 20, 2021
87fab7e
added region
Sep 20, 2021
7b04a99
added artifacts
Sep 20, 2021
4cfdae8
added artifacts
Sep 20, 2021
4609752
added sample api script
Sep 20, 2021
a684a3c
Update sample-api-aws.yaml
rajeevranjan123 Sep 30, 2021
038d3b9
Update sample-api-aws.yaml
rajeevranjan123 Sep 30, 2021
3c15fdb
Update sample-api-aws.yaml
rajeevranjan123 Sep 30, 2021
e61f693
Update sample-api-aws.yaml
rajeevranjan123 Oct 1, 2021
566e732
Update sample-api-aws.yaml
rajeevranjan123 Oct 3, 2021
53f0ae3
Update sample-api-aws.yaml
rajeevranjan123 Oct 3, 2021
00b3e7f
Update sample-api-aws.yaml
rajeevranjan123 Oct 3, 2021
0de06b0
Update sample-api-aws.yaml
rajeevranjan123 Oct 3, 2021
cb74a1e
Update sample-api.sh
rajeevranjan123 Oct 3, 2021
176ee09
Update sample-api.sh
rajeevranjan123 Oct 3, 2021
e63e696
Update sample-api-aws.yaml
rajeevranjan123 Oct 3, 2021
06aaa3a
Update promotions-manager-all-aws-loadtest.yaml
rajeevranjan123 Oct 4, 2021
a535a58
Update promotions-manager-all-aws-loadtest.yaml
rajeevranjan123 Oct 4, 2021
cd660b7
Update sample-api.yaml
rajeevranjan123 Oct 4, 2021
7c9074e
Update sample-api.yaml
rajeevranjan123 Oct 4, 2021
42ff1c4
Update sample-api-command.sh
rajeevranjan123 Oct 4, 2021
aa1b589
Update sample-api.yaml
rajeevranjan123 Oct 4, 2021
04f44d4
Update sample-api.yaml
rajeevranjan123 Oct 4, 2021
869563f
Update sample-api-aws.yaml
rajeevranjan123 Oct 4, 2021
7a99265
Update sample-api.sh
rajeevranjan123 Oct 4, 2021
3f1f5a0
Update sample-api.yaml
rajeevranjan123 Oct 4, 2021
4ba40db
Update sample-api.yaml
rajeevranjan123 Oct 4, 2021
757d8b9
Update sample-api.yaml
rajeevranjan123 Oct 4, 2021
4388f6a
Update sample-api.yaml
rajeevranjan123 Oct 4, 2021
2026934
Update sample-api.yaml
rajeevranjan123 Oct 4, 2021
fb46ecd
Update sample-api.sh
rajeevranjan123 Oct 4, 2021
7963a60
Update sample-api.yaml
rajeevranjan123 Oct 4, 2021
5df43de
Update sample-api.yaml
rajeevranjan123 Oct 4, 2021
fb21384
Update sample-api.yaml
rajeevranjan123 Oct 4, 2021
cbc0d02
Update sample-api.yaml
rajeevranjan123 Oct 4, 2021
8928f3f
Update sample-api.yaml
rajeevranjan123 Oct 4, 2021
55b4819
Update sample-api.yaml
rajeevranjan123 Oct 4, 2021
a84fa4c
no permission
rajeevranjan123 Oct 5, 2021
b061cdf
Updated install permission
rajeevranjan123 Oct 6, 2021
e46ed67
updated healthcheck port
rajeevranjan123 Oct 6, 2021
813e9cf
updated dnf command
rajeevranjan123 Oct 6, 2021
3998d9c
Update sample-api.sh
rajeevranjan123 Oct 6, 2021
f231afe
Update sample-api.sh
rajeevranjan123 Oct 6, 2021
18afdc9
Update sample-api.sh
rajeevranjan123 Oct 6, 2021
5b9bd26
Update sample-api.sh
rajeevranjan123 Oct 6, 2021
236bcb8
Update sample-api.sh
rajeevranjan123 Oct 6, 2021
d384fa1
Update sample-api.sh
rajeevranjan123 Oct 6, 2021
68266b7
Update sample-api.sh
rajeevranjan123 Oct 6, 2021
7a3ca53
Update sample-api.sh
rajeevranjan123 Oct 6, 2021
8009eaf
Update sample-api.sh
rajeevranjan123 Oct 6, 2021
65c9a4f
Update sample-api.sh
rajeevranjan123 Oct 6, 2021
135ad4c
Update sample-api.sh
rajeevranjan123 Oct 6, 2021
a1a8678
Update sample-api.sh
rajeevranjan123 Oct 6, 2021
e52831a
updated running command
rajeevranjan123 Oct 6, 2021
67ee0a8
Update sample-api.sh
rajeevranjan123 Oct 6, 2021
8954e93
Update sample-api.sh
rajeevranjan123 Oct 6, 2021
3688be5
Update sample-api.sh
rajeevranjan123 Oct 6, 2021
485c6a0
Update sample-api.sh
rajeevranjan123 Oct 8, 2021
42a5039
Update sample-api.sh
rajeevranjan123 Oct 8, 2021
6d92cfa
Update sample-api.sh
rajeevranjan123 Oct 8, 2021
5aa385d
Update sample-api.sh
rajeevranjan123 Oct 8, 2021
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
6 changes: 6 additions & 0 deletions applications/mysql/mysql-start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash

echo "****************************************************************"
echo "Restarting MYSQL"
echo "****************************************************************"
systemctl restart mysql.service
53 changes: 53 additions & 0 deletions applications/mysql/mysql.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/usr/bin/env bash

# Stop Script on Error
set -e

# For Debugging (print env. variables into a file)
printenv > /var/log/colony-vars-"$(basename "$BASH_SOURCE" .sh)".txt

apt-get update -y

# Preparing MYSQL for silent installation
export DEBIAN_FRONTEND="noninteractive"
echo "mysql-server mysql-server/root_password password $DB_PASS" | debconf-set-selections
echo "mysql-server mysql-server/root_password_again password $DB_PASS" | debconf-set-selections


# Installing MYSQL
apt-get install mysql-server -y
#apt-get install mysql-client -y


# Setting up local permission file
mkdir /home/pk;
bash -c "cat >> /home/pk/my.cnf" <<EOL
[client]
## for local server use localhost
host=localhost
user=$DB_USER
password=$DB_PASS

[mysql]
pager=/usr/bin/less
EOL

# Creating database
mysql --defaults-extra-file=/home/pk/my.cnf << EOF
CREATE DATABASE ${DB_NAME};
EOF

# Configuring Remote Connection Access: updating sql config to not bind to a specific address
sed -i 's/bind-address/#bind-address/g' /etc/mysql/mysql.conf.d/mysqld.cnf

# granting db access
mysql --defaults-extra-file=/home/pk/my.cnf << EOF
GRANT ALL ON *.* TO ${DB_USER}@'%' IDENTIFIED BY '${DB_PASS}';
EOF

mysql --defaults-extra-file=/home/pk/my.cnf -e "FLUSH PRIVILEGES;"




© 2021 GitHub, Inc.
69 changes: 69 additions & 0 deletions applications/mysql/mysql.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#
# This application file defines how to deploy and configure a MySQL server
#
---
spec_version: 1
kind: application

# These inputs are used by the initialization script to set up
# a database administrator account
inputs:
- DB_USER
- DB_PASS
- DB_NAME

# This section defines the infrastructure requirements for the application
infrastructure:
# Specify the compute requirement for this app
# if we don't specify anything the default will be used
compute:
spec:
aws:
instance_type: t2.medium
azure:
vm_size: Basic_A2
connectivity:
# Port 3306 will be opened internally to receive database requests
internal:
- port_info:
port: 3306

source:
os_type: linux
image:
# This is a clean Ubuntu server image that will
# be used to create a new EC2 instance in the defined
# AWS region
ami:
- id: ami-03ef731cc103c9f09
region: us-east-1
username: ubuntu
azure_image:
- urn: Canonical:UbuntuServer:16.04-LTS:latest
username: adminuser
docker_image:
- tag: 16.04
name: ubuntu

configuration:
# The initialization script is intended to install
# app prerequisite and initialize the OS
# This script installs mysql on a clean Ubuntu OS,
# sets up a root account and creates an empty database
# for the application
initialization:
script: mysql.sh
# This script restarts the mysql.service process after
# the initialization completes
# The start script contains the commands
# needed to start the application process
start:
script: mysql-start.sh
# To validate the installation, we wait to see that
# the ports are available
healthcheck:
wait_for_ports: ALL
timeout: 300

debugging:
connection_protocol: SSH
2 changes: 2 additions & 0 deletions applications/sample-api/health-check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
echo 'Health Check Success!'
3 changes: 3 additions & 0 deletions applications/sample-api/sample-api-command.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bash

echo "starting secrets-manager-api"
128 changes: 128 additions & 0 deletions applications/sample-api/sample-api.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
#!/usr/bin/env bash

echo "********************Initialization started*********************"
# Stop Script on Error
set -e

# For Debugging (print env. variables into a file)
printenv > /var/log/colony-vars-"$(basename "$BASH_SOURCE" .sh)".txt

# Update packages and Upgrade system
echo "****************************************************************"
echo "Updating System"
echo "****************************************************************"
apt-get update -y


echo "****************************************************************"
echo "Installing python"
echo "****************************************************************"
sudo apt install -y software-properties-common
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt update -y
sudo apt install -y python3.8
sudo apt install -y python3-pip
echo python3 --version

python3 -m pip install -U numpy --user
python3 -m pip install -U setuptools --user
python3 -m pip install -U Flask --user

echo "*********************************************"
# echo "last try for python installation"
# sudo apt install -y build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev wget
# cd /tmp
# wget https://www.python.org/ftp/python/3.7.5/Python-3.7.5.tgz
# tar -xf Python-3.8.3.tgz
# cd python-3.8.3
# sudo make altinstall
# sudo make install
# echo python --version
# echo python3 --version

echo "****************************************************************"
echo "Installing Nginx"
echo "****************************************************************"
sudo apt update -y
sudo apt install -y nginx
sudo service nginx start

cd /etc/nginx/sites-available
cat << EOF > default
server {
listen 3001;
server_name *.com;
# root /var/www/sample-api;
location / {
proxy_pass http://localhost:5000;
proxy_http_version 1.1;
proxy_set_header Upgrade \$http_upgrade;
proxy_set_header Connection keep-alive;
proxy_set_header Host \$host;
proxy_cache_bypass \$http_upgrade;
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto \$scheme;
}
}
EOF

echo 'sites available modified'

sudo nginx -s reload

echo 'reload successful'
echo "****************************************************************"
echo "Installing Nginx compleated"
echo "****************************************************************"


echo "****************************************************************"
echo '==> Extract api artifact to /var/sample-api'
echo "****************************************************************"
echo $ARTIFACTS_PATH

mkdir $ARTIFACTS_PATH/drop
tar -xvf $ARTIFACTS_PATH/sample-api-*.tar.gz -C $ARTIFACTS_PATH/drop/

echo $ARTIFACTS_PATH
echo "*********************artifacts copied to root**********************************"
mkdir /var/sample-api/

# tar -xvf $ARTIFACTS_PATH/drop/sample-api-* -C /var/sample-api

echo "**********************copy(scp) to certain folder**************"
# tar -xzvf latest.tar.gz
rsync -av $ARTIFACTS_PATH/drop/sample-api-* /var/sample-api/

echo "*********************artifacts copied to root**********************************"

echo 'RELEASE_NUMBER='$RELEASE_NUMBER >> /etc/environment
echo 'API_BUILD_NUMBER='$API_BUILD_NUMBER >> /etc/environment
echo 'API_PORT='$API_PORT >> /etc/environment
source /etc/environment

echo "********************Initialization finished*********************"


echo '******Start api/script**************************'
echo python3 --version
python3 --version

# python3 sample-api.py
python3 /var/sample-api/sample-api-0.0.1/src/example/sample-api.py
echo '******End api/Script ***********************************'

# echo '==> Installing NPM and PM2'
# apt-get update
# apt install curl -y
# curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.0/install.sh | bash
# nvm --version

# npm install -g pm2

# echo '==> Start our api and configure as a daemon using pm2'
# pm2 start /var/sample-api/sample-api-0.0.1/src/example/sample-api.py
# pm2 save
# chattr +i /root/.pm2/dump.pm2

# echo '==> END our api and configure as a daemon using pm2'
52 changes: 52 additions & 0 deletions applications/sample-api/sample-api.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
spec_version: 1
kind: application
inputs:
- PORT: 3000
- API_PORT: 3001
- AZURE_VM_SIZE: Basic_A1
- AWS_INSTANCE_TYPE: t2.micro
- RELEASE_NUMBER: none
- API_BUILD_NUMBER: none

infrastructure:
connectivity:
internal:
- port_info:
port: $PORT
ingress-healthcheck:
healthy-threshold: 5
interval: 30
path: /
status-codes: 200-299
timeout: 2
unhealthy-threshold: 2
compute:
spec:
azure:
vm_size: $AZURE_VM_SIZE
aws:
instance_type: $AWS_INSTANCE_TYPE

configuration:
start:
script: sample-api-command.sh
initialization:
script: sample-api.sh
healthcheck:
wait_for_ports: $API_PORT
timeout: 360

source:
image:
docker_image:
- name: ubuntu
tag: 18.04
ami:
- id: ami-09e67e426f25ce0d7
region: us-east-1
username: ubuntu
os_type: linux

debugging:
connection_protocol: SSH

53 changes: 53 additions & 0 deletions applications/wordpress/wordpress.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/usr/bin/env bash

# Stop Script on Error
set -e

# For Debugging (print env. variables into a file)
printenv > /var/log/colony-vars-"$(basename "$BASH_SOURCE" .sh)".txt

# Update packages and Upgrade system
echo "****************************************************************"
echo "Updating System"
echo "****************************************************************"
apt-get update -y


echo "****************************************************************"
echo "Installing Apache"
echo "****************************************************************"
apt-get install apache2 apache2-utils -y
systemctl enable apache2
systemctl start apache2


echo "****************************************************************"
echo "Installing PHP Modules"
echo "****************************************************************"
apt-get install php7.0 php7.0-mysql libapache2-mod-php7.0 php7.0-cli php7.0-cgi php7.0-gd -y



echo "****************************************************************"
echo "Installing Wordpress"
echo "****************************************************************"
wget -c http://wordpress.org/latest.tar.gz
tar -xzvf latest.tar.gz
rsync -av wordpress/* /var/www/html/
chown -R www-data:www-data /var/www/html/
chmod -R 755 /var/www/html/
rm /var/www/html/index.html


echo "****************************************************************"
echo "Configuring database access"
echo "****************************************************************"
cd /var/www/html || exit
mv wp-config-sample.php wp-config.php

sed -i "s/database_name_here/$DB_NAME/g" wp-config.php
sed -i "s/username_here/$DB_USER/g" wp-config.php
sed -i "s/password_here/$DB_PASS/g" wp-config.php
sed -i "s/localhost/$DB_HOSTNAME/g" wp-config.php

systemctl restart apache2.service
Loading