Skip to content

Commit

Permalink
doc: change readme and install openfaas.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
levisingularity committed Sep 7, 2023
1 parent 0f83185 commit fd907c3
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 21 deletions.
48 changes: 29 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
# das-pre-infra-vultr
Scripts/assets to provision and instantiate required hardware in Vultr
# DAS-infra-stack-servless

## Resources:
- Instances on Vultr cloud

## Objective:
Create instances on Vultr cloud to deploy the Redis DB, Mongo DB and functions on OpenFaas server. The instances in production env are a Bare Metal Type
Serverless infra with Vultr, OpenFaaS, Ansible, Terraform.

## Configuration

Expand Down Expand Up @@ -85,51 +80,66 @@ terraform plan -destroy -var-file=config.tfvars -out tfplan-destroy
terraform apply tfplan-destroy
```

## Faas registry

### Prepare your Docker registry (if using AWS ECR)

```
faas-cli registry-login --ecr --region <your-aws-region> --account-id <your-account-id>
```

https://docs.openfaas.com/reference/private-registries/

## Configure OpenFaas server before up the stack.yml

create ssh:
add the user to Docker group and create ssh:

```
sudo usermod -aG docker $USER
ssh-keygen -t rsa
cat ~/.ssh/id_rsa.pub
```

add the public key on github

Clonning repositories:

```
git clone link-of-function-repo
git clone [email protected]:singnet/das-infra-stack-vultr.git
```

configure aws, putting the credential to aws:
```
'''
aws configure
```
'''

Connecting docker on aws ecr registry (if other private registry, see faasd documentation):
```
Connecting docker on aws ecr registry:
'''
aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin 038760728819.dkr.ecr.us-east-1.amazonaws.com/das
```
'''

generating credentials folder to faas stack:

```
cd DAS-deployment-openFaas
faas-cli registry-login --ecr --region us-east-1 --account-id 038760728819
```

login to faas gateway:
```
'''
sudo cat /var/lib/faasd/secrets/basic-auth-password
faas-cli login -u admin -p password
```
'''

copy the docker config auth to faas config auth:

```
sudo cp ~/.docker/config.json /var/lib/faasd/.docker/config.json
cp ~/.docker/config.json /var/lib/faasd/.docker/config.json
```

up functions:

```
faas-cli up -f das-function.yml
```
```
2 changes: 1 addition & 1 deletion config.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ production_instances_plan = "vbm-8c-132gb-v2"
test_instances_plan = "vc2-1c-1gb"

ssh_key_ids = [
"0d6d2a44-56e9-4f34-8db4-8831c4f16beb", # Senna
"0d6d2a44-56e9-4f34-8db4-8831c4f16beb", # Senna AWS
"6997c2c3-7dbf-409a-b98e-550140494152", # Levi
]
3 changes: 2 additions & 1 deletion install-openfaas.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,5 @@ snap install aws-cli --classic
EOF

chmod +x install-aws-cli.sh
./install-aws-cli.sh >> install-aws-cli.log 2>&1
# ./install-aws-cli.sh >> install-aws-cli.log 2>&1

0 comments on commit fd907c3

Please sign in to comment.