Below command will host current directory as http server on specified port
Python2:
python -m SimpleHTTPServer <port_number>
python3:
python3 -m http.server <port_number>
Below command will host current directory as http server on specified port
Python2:
python -m SimpleHTTPServer <port_number>
python3:
python3 -m http.server <port_number>
What’s LXC?
– API to communicate with with LXD(Linux container)
What’s LXD?
– It’s like VM for Linux containers
yum -y install epel-release
yum -y install libvirt lxc lxc-templates libcap-devel libcgroup busybox wget bridge-utils lxc-extra
systemctl start libvirtd
systemctl enable libvirtd
[root@lxc01~]# lxc-checkconfig
Kernel configuration not found at /proc/config.gz; searching...
Kernel configuration found at /boot/config-3.10.0-862.el7.x86_64
--- Namespaces ---
Namespaces: enabled
Utsname namespace: enabled
Ipc namespace: enabled
Pid namespace: enabled
User namespace: enabled
newuidmap is not installed
newgidmap is not installed
Network namespace: enabled
Multiple /dev/pts instances: enabled
--- Control groups ---
Cgroup: enabled
Cgroup clone_children flag: enabled
Cgroup device: enabled
Cgroup sched: enabled
Cgroup cpu account: enabled
Cgroup memory controller: enabled
Cgroup cpuset: enabled
--- Misc ---
Veth pair device: enabled
Macvlan: enabled
Vlan: enabled
Bridges: enabled
Advanced netfilter: enabled
CONFIG_NF_NAT_IPV4: enabled
CONFIG_NF_NAT_IPV6: enabled
CONFIG_IP_NF_TARGET_MASQUERADE: enabled
CONFIG_IP6_NF_TARGET_MASQUERADE: enabled
CONFIG_NETFILTER_XT_TARGET_CHECKSUM: enabled
--- Checkpoint/Restore ---
checkpoint restore: enabled
CONFIG_FHANDLE: enabled
CONFIG_EVENTFD: enabled
CONFIG_EPOLL: enabled
CONFIG_UNIX_DIAG: enabled
CONFIG_INET_DIAG: enabled
CONFIG_PACKET_DIAG: enabled
CONFIG_NETLINK_DIAG: enabled
File capabilities: enabled
Note : Before booting a new kernel, you can check its configuration
usage : CONFIG=/path/to/config /usr/bin/lxc-checkconfig
lxc-create -n centos7container -t centos
It will pull the centos container image from the internet and will use the centos template from /usr/share/lxc/templates/
lxc-start -n centos7container -d
[root@lxc01 ~]# lxc-ls
centos7container
[root@lxc01 ~]# lxc-ls --active
centos7container
lxc-attach -n centos7container
lxc-stop -n centos7container
lxc-destroy -n centos7container
Fast: dd if=/dev/zero of=out.img bs=1m iflag=fullblock,count_bytes count=1G
Faster(kind of): truncate -s 1G out.img
Fastest : fallocate -l 1G out.img
Jenkinsfile
pipeline
{
agent any
stages
{
stage('build')
{
steps
{
script
{
//first.groovy path might change as per your need
def var1 = load "first.groovy"
var1.build("php build")
}
sh '''
echo "build"
'''
}
}
stage('deploy')
{
steps
{
script
{
def var2 = load "first.groovy"
var2.build("php deploy")
}
sh '''
echo "deploy"
'''
}
}
}
}
first.groovy
def build(String arg1) {
sh """
echo "from build function : ${arg1}"
"""
}
def deploy(String arg2) {
sh """
echo "from deploy function : ${arg2}"
"""
}
return this
Output:
Running on Jenkins in /var/lib/jenkins/workspace/initedit/ss
[Pipeline] {
[Pipeline] stage
[Pipeline] { (build)
[Pipeline] script
[Pipeline] {
[Pipeline] load
[Pipeline] { (first.groovy)
[Pipeline] }
[Pipeline] // load
[Pipeline] sh
+ echo 'from build function : php build'
from build function : php build
[Pipeline] }
[Pipeline] // script
[Pipeline] sh
+ echo build
build
...........
git fetch --all
OR
git remote update
Note: It will not update local repo.
To pull all branch
git pull --all
Note: It will update local repo.
docker run -d -p 26900:26900/udp -p 27020:27020/udp -p 27015:27015/udp -p 27015:27015 -e ADMIN_STEAM=0:1:1234566 --name cs cs16ds/server:latest
For interactive docker terminal change the entry point:docker run it --entrypoint /bin/bash --name cs cs16ds/server:latest
mkdir cs
cd cs
wget https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz
tar xvfz steamcmd_linux.tar.gz
sudo apt-get install lib32gcc1
./steamcmd.sh
login anonymous
force_install_dir ./cs16/
app_update 90 validate (run till you get fully installed message)
exit
cd cs16server
./hlds_run -console -game cstrike +port 27015 +de_dust2 +maxplayers 32 -pingboost 1
Install addons:
amxmodx dproto metamod
https://wiki.alliedmods.net/Installing_AMX_Mod_X_Manually
Note: path for metamod.so should not be absolute.
http://www.amxmod.net/doc/amxmod_2010.1/en/amxusers.html
By default ssh password login is disabled on above cloud provider
To enable SSH root login edit /etc/ssh/sshd_config and enable below options and restart sshd service.PasswordAuthentication yes
PermitRootLogin yes
Restart SSH Servicesystemctl restart sshd
# Install Prometheus https://prometheus.io/download/wget https://github.com/prometheus/prometheus/releases/download/v2.13.1/prometheus-2.13.1.linux-amd64.tar.gz
tar -xf prometheus-2.13.1.linux-amd64.tar.gz
nano /etc/systemd/system/prometheus.service
mv prometheus-2.13.1.linux-amd64 /etc/prometheus
[Unit]
Description=Prometheus
Wants=network-online.target
After=network-online.target
[Service]
User=root
Group=root
Type=simple
ExecStart=/usr/local/bin/prometheus \
–config.file /etc/prometheus/prometheus.yml \
–storage.tsdb.path /var/lib/prometheus/ \
–web.console.templates=/etc/prometheus/consoles \
–web.console.libraries=/etc/prometheus/console_libraries
[Install]
WantedBy=multi-user.target
cd /etc/prometheus
cp prometheus promtool tsdb /usr/local/bin/
systemctl daemon-reload
systemctl enable prometheus
systemctl start prometheus
Prometheus port : 9090
# Install node_exporter
wget https://github.com/prometheus/node_exporter/releases/download/v0.18.1/node_exporter-0.18.1.linux-amd64.tar.gz
tar -xf node_exporter-0.18.1.linux-amd64.tar.gz
cp node_exporter-0.18.1.linux-amd64 /node_exporter /usr/local/bin/
nano /etc/systemd/system/node_exporter.service
[Unit]
Description=Node Exporter
Wants=network-online.target
After=network-online.target
[Service]
User=root
Group=root
Type=simple
ExecStart=/usr/local/bin/node_exporter
[Install]
WantedBy=multi-user.target
systemctl daemon-reload
systemctl start node_exporter
systemctl status node_exporter
systemctl enable node_exporter
# add node_exporter to prometheus.yml
systemctl restart prometheus
iptables -A INPUT -p tcp --dport 22 -s 192.168.0.10 -j ACCEPT
iptables -A INPUT -p tcp --dport 22 -s 10.16.10.10 -j ACCEPT
iptables -A INPUT -p tcp --dport 22 -j DROP
#Drop All rules
iptables -F