Skip to content

Instantly share code, notes, and snippets.

@hackedunit
hackedunit / dir_backup.sh
Created October 11, 2018 10:44
Gzip a directory and upload to Azure Blob storage
#!/bin/bash
# Requires azure-cli to be installed
source $HOME/.profile
echo "backing up media dir..."
tar -zcf /tmp/media.gz /var/www/app/shared/media
@hackedunit
hackedunit / db_backup.sh
Last active August 16, 2023 10:23
Backup PostgreSQL dump to Microsoft Azure Blob Storage
#!/bin/bash
# Requires azure-cli to be installed
source $HOME/.profile
if [ "${POSTGRES_HOST}" = "" ]; then
if [ -n "${POSTGRES_PORT_5432_TCP_ADDR}" ]; then
POSTGRES_HOST=$POSTGRES_PORT_5432_TCP_ADDR
POSTGRES_PORT=$POSTGRES_PORT_5432_TCP_PORT
@hackedunit
hackedunit / cloudnet
Created March 7, 2017 10:38
Sample nginx config for cloudnet
upstream app {
server unix:///home/cloudnet/app/shared/sockets/puma.sock;
}
server {
server_name cloudnet.com www.cloudnet.com;
listen 80;
rewrite ^ https://www.cloudnet.com$request_uri? permanent;
}
@hackedunit
hackedunit / puma.service
Created March 7, 2017 10:23
Puma systemd config for cloudnet
[Unit]
Description=Puma HTTP Server
After=network.target
# Uncomment for socket activation (see below)
# Requires=puma.socket
[Service]
# Foreground process (do not use --daemon in ExecStart or config.rb)
Type=simple
@hackedunit
hackedunit / sidekiq.service
Created March 7, 2017 10:18
Sidekiq systemd config for cloudnet
[Unit]
Description=Sidekiq
After=network.target
[Service]
User=cloudnet
Group=cloudnet
WorkingDirectory=/home/cloudnet/app
EnvironmentFile=/home/cloudnet/app/.env.production
ExecStart=/bin/bash -lc 'bundle exec sidekiq -C config/sidekiq.yml'
@hackedunit
hackedunit / install-redis.md
Last active October 11, 2023 12:37
Install and configure Redis on Ubuntu 16.04 with systemd
  1. Install pre-requisities

sudo apt-get install build-essential tcl

  1. Install Redis
cd /tmp
curl -O http://download.redis.io/redis-stable.tar.gz
tar xzvf redis-stable.tar.gz
[Unit]
Description=Redis In-Memory Data Store
After=network.target
[Service]
User=redis
Group=redis
ExecStart=/usr/local/bin/redis-server /etc/redis/redis.conf
ExecStop=/usr/local/bin/redis-cli shutdown
Restart=always
# Change to match your CPU core count
workers 8
# Min and Max threads per worker
threads 4, 8
app_dir = File.expand_path("../..", __FILE__)
shared_dir = "#{app_dir}/shared"
# Default to production
[Unit]
Description=Puma HTTP Server
After=network.target
# Uncomment for socket activation (see below)
# Requires=puma.socket
[Service]
# Foreground process (do not use --daemon in ExecStart or config.rb)
Type=simple
@hackedunit
hackedunit / install.markdown
Last active April 4, 2016 18:29
Cloud.net install guide

This is a quick step-by-step guide to install Cloud.net on a server using Docker.

Minimum requirements

  • A server running Ubuntu 14.04 LTS with at least 2GB of RAM.
  • Onapp control panel with required permissions
  • SMTP and few other third party logins

Installation