
For the folks that are impatient, the POC of DeepSeek is here KarMeng / deepseek-simple / localdev — Bitbucket
Continue readingFor the folks that are impatient, the POC of DeepSeek is here KarMeng / deepseek-simple / localdev — Bitbucket
Continue readingThis post is based on reference to Use instance metadata to manage your EC2 instance – Amazon Elastic Compute Cloud
Metadata is a powerful tool for AWS users. It allows users to make query of data describing EC2 instances, and making a self reference API call.
By default any linux AMI will have curl build in, hence using of metadata will be simplified.
One of the best test case is automating input into shell script that will requires a lot of user prompt is automating or at least make configuration of setting up openvpn using AWS Lightsail easier.
!#/bin/bash
sudo chmod 777 ./openvpn-install.sh
sudo ./openvpn-install.sh << INPUT
y
1
1
11
n
n
client
1
INPUT
sudo cp /root/client.ovpn /home/ubuntu
sudo chmod 777 /home/ubuntu/client.ovpn
Above shell script will cause the openvpn-install.sh to fail in AWS, as the script does not provide public and local ip of the instance.
Below script are including the AWS Metadata
!#/bin/bash
TOKEN=`curl -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600"`
PUBLICIP=`curl -X GET "http://169.254.169.254/latest/meta-data/public-ipv4" -H "X-aws-ec2-metadata-token: $TOKEN"`
LOCALIP=`curl -X GET "http://169.254.169.254/latest/meta-data/local-ipv4" -H "X-aws-ec2-metadata-token: $TOKEN"`
sudo chmod 777 ./openvpn-install.sh
sudo ./openvpn-install.sh << INPUT
$LOCALIP
$PUBLICIP
y
1
1
11
n
n
client
1
INPUT
sudo cp /root/client.ovpn /home/ubuntu
sudo chmod 777 /home/ubuntu/client.ovpn
By adding the metadata the ovpn file will be populated with correct IP.
AWS Metadata allow automation to be made simpler by running scripts that requires self-reference metadata to configure newly booted up EC2 instance(s).
This post is based on terraform tutorial Build infrastructure | Terraform | HashiCorp Developer
Make sure AWSCli being installed and configured correctly (aws configure). Make sure IAM user are configured with AWS role, AWS Access key ID and AWS Secret Access Key.
Use the ami catalog, to determine the ami ID, then after make necessary changes run the init
To solve this VPC and subnet needs to be created first.
Make small change to the EC2 instance of terraform file.
Rerun the terraform init, terraform plan, terraform validate before rerunning terraform apply, then type yes.
To clean up the experiment to avoid paying more, start by destroying the instance then the VPC.
Terraform code is available at https://bitbucket.org/KarMeng/terraform_aws
All the experience in this post is based on Install Terraform | Terraform | HashiCorp Developer
Feels like running ansible but simpler, as the tutorial of quickstart runs on docker engine.
Further confirmation running browser to browse the site.
Have added changes to incorporate both generating AWStats logs and starting up AWStats service in a single docker compose file at KarMeng / docker_awstats — Bitbucket
This is an easy and simple example that beginners can use to generate web statistics using AWStats.
Required softwares:
Hashicorp Vagrant 2.4.1
Oracle VirtualBox 7.0.14
The first error that will be face on get go is the error “kibana Your kernel does not support swap limit capabilities or the cgroup is not mounted. Memory limited without swap” and exiting error “dependency failed to start: container docker-es03-1 exited (137)”.
Searching mentioned error on google or the internet will yield result that advice swap memory and memory limit hit.
Continue readingPre-requisite:
– VirtualBox 7.0.14
– Vagrant 2.4.1
– Windows 10 or better OS
– 16GB RAM (10GB RAM are required for creating ElasticSearch with kibana; 1GB and 2 x ElasticSearch node; 4GB each, rest of the RAM for VM host OS)
Overview:
There are 2 layers of virtualization, first the Virtual Box, then the docker engine running in the Virtual Box VM running on Ubuntu 20.04 focal.
Orchestration used in the host OS level; Windows 10 are the hashicorp vagrant. The vagrant is used to configure the VM Ubuntu OS to be configured to run properly configured docker and Ubuntu 20.04.
Then docker compose v2 are used to create the ElasticSearch 8.12 cluster or stack.
The downside of this example, vagrant up needs to be run initially to configure the VM Ubuntu 20.04 OS. I have yet to discover if Vagrant has the ability to bootstrap grub and configuring the sysctl to allow the docker engine to run properly with the ElasticSearch 8.12 stack.
Continue readingThe code of the project is available at chowkarmeng/vagrant_gitlab (github.com), the docker compose is based on the sample provided in GitLab Docker images | GitLab
The improvement done was to change the folder sync for virtual box into docker volumes.
First, git clone the repository https://github.com/chowkarmeng/vagrant_gitlab.git
The process will take hours depending on the speed of your computer and speed of your internet connection.
Continue readingAt the time of this post, the compatibility matrix of vagrant and VirtualBox is as follows:
Vagrant version | VirtualBox version | |
2.3.7 | 7.0.10 | |
7.0.12 |
Unfortunately, Vagrant 2.4.0 does not work well with VirtualBox 7.0
This post was created using Vagrant 2.3.7 and VirtualBox 7.0.10
To make Vagrant possible, after installing the Vagrant from hashicorp webpage, a Vagrant file needs to be created. The most basic file that needs to exist in your Vagrant to work is a folder with Vagrantfile
Additional post start up scripts to complete the installations that are used in this example are setup.sh, install_ansible.sh, install_boto3.sh and install_python3.sh
Continue readingPre-requisites:
1. Download “openvpn-install.sh” GitHub – angristan/openvpn-install: Set up your own OpenVPN server on Debian, Ubuntu, Fedora, CentOS or Arch Linux.
2. Have Amazon Lightsail activated with quota in AWS account.
* Credits to cyberciti for instructions and the scripts introduction Ubuntu 20.04 LTS Set Up OpenVPN Server In 5 Minutes – nixCraft (cyberciti.biz)
3. SSH keypair are created and added into your AWS account.
4. Make sure OpenVPN client is install on your computer OpenVPN Connect – Client Software For Windows | OpenVPN
Steps:
Creating a Ubuntu AWS instance
1. Click on “Create Instance”
2. Select OS only, and choose your favorite Linux distro, in my case Ubuntu were chosen.
At the time of this blog post created, the openvpn install script works on both ubuntu 22.04 and 20.04