2023-08-14 - Old Deploy service - Graph Handler instructions

From Izara Wiki
Jump to navigation Jump to search

Deploy instructions

  1. Clone project
  2. cd \rbac\resource >> npm install
  3. cd \rbac\app >> npm install
  4. modify config/serverless.config.yml
    • iz_serviceName(optional)
    • iz_stage (optional)
    • iz_region (optional)
    • iz_accountId (optional)
    • iz_logLevel (optional)
  5. modify config/serverless.config.yml : For resources
    1. iz_DefaultKeyPairName: neo4jSharedKeyName
      • require existing key pair and make sure have private key pair installed on local computer
      • #Create key pair
    2. iz_ImageId: ami-12xxxx33xxxxxx
    3. iz_VPCCidrBlock: 172.16.0.0/16
      • private IP range for VPC
    4. iz_Subnet1CidrBlock:172.16.10.0/24
      • private IP range for subnet
    5. iz_Subnet1Public: true
      • custom value, eg: true/false
  6. cd \permission-handler\resource
  7. serverless deploy
  8. After deploy resource, need to connect with neo4j instance for setup user and password
    • https://Public IPv4 address: xxxxxxx
    • Default user/password neo4j instance is neo4j, require to create new password
  9. modify config/serverless.config.yml: For app
    1. iz_neo4jPort: bolt://172.16.10.249:7687
    2. iz_neo4jUser: neo4j
      • username will set when first time connect with instance
    3. iz_neo4jPassword:neo4j2
      • password will set when first time connect with instance
    4. iz_securityGroupIds: sg-xxxxxxxxxxx
      • get from Instance page : EC2> Instances > I-xxx > tab: Security > Security groups > copy sg-xxxx
    5. iz_subnetIds1a: subnet-xxxxxxxxxxxxxxx
      • get from Service VPC > Subnets
      • and get Subnet ID in VPC that instance exist
      • Vpc subnet ids.png
  10. cd \permission-handler\app
  11. serverless deploy

Create key pair

In terminal:

export KEY_NAME="Neo4j-AWSMarketplace-Key”
aws ec2 create-key-pair --key-name $KEY_NAME --query 'KeyMaterial'--output text > $KEY_NAME.pem

Aws keypair.jpg

Find EC2 image ami

  1. in AWS console
  2. EC2 -> Images -> AMIs
  3. click Change Owned by me to Public images Search "neo4j-community"
  4. Select one with "Owner" field showing this number: 385155106615, copy AMI ID
    • Note: should select a different image-id ami from existing instance to avoid crash

Ec2 neo4j ami images.png

Bash script to refresh multiple services

{
declare -a refresh_seed_services=(
	"Rbac"
	"Permission"
	"UserAccount"
)

stage="Test"
region="us-east-2"

echo "region: $region"

for refresh_seed_service in "${refresh_seed_services[@]}"; do
	echo "=================================="
	echo "start refresh seed data for ${refresh_seed_service}, function name: ${refresh_seed_service}${stage}RefreshSeedData"

	aws lambda invoke \
	--function-name "${refresh_seed_service}${stage}RefreshSeedData" out \
	--invocation-type Event \
	--log-type Tail \
	--cli-binary-format raw-in-base64-out \
	--region=${region}
done
}