Skip to content

Instantly share code, notes, and snippets.

@tarsnake
tarsnake / .gitignore
Last active August 29, 2015 14:08 — forked from starenka/.gitignore
.idea/*
*.pyc
@tarsnake
tarsnake / supervisord.sh
Last active August 29, 2015 14:08 — forked from danmackinlay/supervisord.sh
supervisord init script
#! /bin/sh
### BEGIN INIT INFO
# Provides: supervisord
# Required-Start: $remote_fs
# Required-Stop: $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Example initscript
# Description: This file should be used to construct scripts to be
# placed in /etc/init.d.
@tarsnake
tarsnake / gist:b1186cf8e01335a47c07
Last active August 29, 2015 14:08 — forked from FlaviuSim/gist:2510028
sample ini for supervisord
[unix_http_server]
file=/tmp/supervisor.sock ; (the path to the socket file)
[supervisord]
logfile=/tmp/supervisord.log ; (main log file;default $CWD/supervisord.log)
logfile_maxbytes=50MB ; (max main logfile bytes b4 rotation;default 50MB)
logfile_backups=10 ; (num of main logfile rotation backups;default 10)
loglevel=info ; (log level;default info; others: debug,warn,trace)
pidfile=/tmp/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
nodaemon=false ; (start in foreground if true;default false)
minfds=1024 ; (min. avail startup file descriptors;default 1024)
; Sample supervisor config file.
[unix_http_server]
file=/tmp/supervisor.sock ; (the path to the socket file)
;chmod=0700 ; sockef file mode (default 0700)
;chown=nobody:nogroup ; socket file uid:gid owner
;username=user ; (default is no username (open server))
;password=123 ; (default is no password (open server))
;[inet_http_server] ; inet (TCP) server disabled by default
@tarsnake
tarsnake / fabfile.py
Last active August 29, 2015 14:08 — forked from cloudaice/fabfile.py
from __future__ import with_statement
import os
from django.core import management
# We have to re-name this to avoid clashes with fabric.api.settings.
import ohbooklist.conf.local.settings as django_settings
management.setup_environ(django_settings)
from fabric.api import *

Introduction

Create a sudo user

adduser appuser
passwd appuser
# Provide the password here
Barebones Server Setup
Current Linux Distro: Ubuntu 10.04 LTS
###
Optional:
or UPDATE distro in /etc/apt/sources.list run apt-get update and apt-get dist-upgrade
solve perl: warning: Setting locale failed.
https://gist.github.com/panchicore/1269109
# Flask installer
# If you want a quick setup for a flask app on CentOs 7, try this.
# Requires 'requirements.txt' on your application folder.
# WARNING: this script will open port 8081!
# ideas:
# - http://linuxcommand.org/lc3_new_script.php
# - http://stackoverflow.com/questions/14008125/shell-script-common-template
from fabric.api import run, require, env, hide, sudo, execute
from fabric.api import local, warn_only, cd, put, settings, show, hide
from fabric.contrib.files import append, sed
from fabric.contrib.project import rsync_project
import os
def vagrant():
"""Use the local virtual machine to run commands
@tarsnake
tarsnake / fabfile.py
Last active August 29, 2015 14:09 — forked from elliottb/fabfile.py
from fabric.api import local, run, env, put
import os, time
# remote ssh credentials
env.hosts = ['10.1.1.25']
env.user = 'deploy'
env.password = 'XXXXXXXX' #ssh password for user
# or, specify path to server public key here:
# env.key_filename = ''