Gitlab Runner config to auto deploy your static site on S3

If you didn’t know, you can easily setup your static website and host on S3. Just follow these simple instructions and you are done.
https://docs.aws.amazon.com/AmazonS3/latest/dev/website-hosting-custom-domain-walkthrough.html

Now you might want to version control your hosted website and would want to avoid uploading this content again and again.
With the help of Gitlab Runner you can simply remove the hassle of uploading your updated code.
Continue reading “Gitlab Runner config to auto deploy your static site on S3”

Setting up Swap Memory in linux server

Clickbait version: Increase your server’s system memory for free! 😀

Swap space in Linux is used when the amount of physical memory (RAM) is full. If the system needs more memory resources and the RAM is full, inactive pages in memory are moved to the swap space.[src]

Note: Not recommended to be used in production environment. Swap space is very slow compared to physical memory and can seriously affect your application performance.

It’s fairly common to run into “System.OutOfMemoryException” if you are running a memory heavy application or multiple applications on a remote server.  To mitigate this issue you can simply create a Swap space for your server and use your disk space as system memory, this will be a little slower but you wouldn’t have to upgrade your server to higher memory one if you just need some MBs of extra ram or maybe need to perform a single task which needs some extra memory.

To enable 2GB of swap space use the following commands

SWAPFILE=/var/swapfile
SWAP_MEGABYTES=2048

sudo /bin/dd if=/dev/zero of=$SWAPFILE bs=1M count=$SWAP_MEGABYTES
sudo /bin/chmod 600 $SWAPFILE
sudo /sbin/mkswap $SWAPFILE
sudo /sbin/swapon $SWAPFILE

Continue reading “Setting up Swap Memory in linux server”