Skip to content

Instantly share code, notes, and snippets.

View aujkis's full-sized avatar
🎯
Focusing

Austris aujkis

🎯
Focusing
View GitHub Profile
@aujkis
aujkis / setup.sh
Created August 8, 2019 07:42 — forked from eduwass/setup.sh
Flynn Install : Single node ( for Ubuntu 14.04 x64 @ DigitalOcean droplet )
#!/bin/bash
# This script will automatically set up a single node Flynn Cluster on your linux box
# Fresh Flynn install with domain provided by the xip.io service
# Tested with Base Image: Ubuntu 14.04 x64 @ DigitalOcean droplet
# @date 16 Nov 2015
# @author Edu Wass (eduwass at gmail com)
echo '---- START SETUP ----'
@aujkis
aujkis / README.md
Created August 8, 2019 07:41 — forked from zulhfreelancer/README.md
How to install Flynn on single host (single-node mode)?

$ sudo bash -c "$(curl -s https://gist.githubusercontent.com/zulhfreelancer/0b87a274686cb4d98b8144e116c5117c/raw)"

@aujkis
aujkis / README.md
Created January 29, 2019 20:47 — forked from jimeh/README.md
A simple key/value store model for Rails using the database and memcache

Rails Setting model

This is a semi-quick key/value store I put together for a quick way to store temporary data related to what's in my database, in a reliable way. For example, I'm using it to keep track of where a hourly and a daily crontask that processes statistics left off, so it can resume only processing and summarizing new data on the next run.

Code quality most likely is not great, but it works. And I will update this gist as I update my project.

How It Works

The settings table has two columns, a key and a value column. The value column is serialized, so you can technically store almost anything in there. Memcache is also used as a caching layer to minimize database calls.

@aujkis
aujkis / README.md
Created January 29, 2019 20:47 — forked from fredrikhenne/README.md
A simple key/value store model for Rails using the database and memcache

Rails Setting model

This is a semi-quick key/value store I put together for a quick way to store temporary data related to what's in my database, in a reliable way. For example, I'm using it to keep track of where a hourly and a daily crontask that processes statistics left off, so it can resume only processing and summarizing new data on the next run.

Code quality most likely is not great, but it works. And I will update this gist as I update my project.

How It Works

The settings table has two columns, a key and a value column. The value column is serialized, so you can technically store almost anything in there. Memcache is also used as a caching layer to minimize database calls.

@aujkis
aujkis / Gemfile
Created August 12, 2017 12:43 — forked from frank-who/Gemfile
Postgres Arrays in Active Admin
ruby '2.2.0'
source 'https://rubygems.org'
...
gem 'font-awesome-rails'
@aujkis
aujkis / active_record_marshalable.rb
Created January 5, 2016 08:29 — forked from keichan34/active_record_marshalable.rb
Get Marshal.dump and Marshal.load to load cached association objects ( Whatever.includes(:example_models) ), as well.
module ActiveRecordMarshalable
def marshal_dump
[attributes, self.association_cache, instance_variable_get(:@new_record)]
end
def marshal_load data
send :initialize, data[0]
instance_variable_set :@association_cache, data[1]
instance_variable_set :@new_record, data[2]
end
# create a mongo app
flynn create --remote "" mongo
# create a release using the latest (at the time of writing) Docker MongoDB image
flynn -a mongo release add -f config.json "https://registry.hub.docker.com?name=mongo&id=216d9a0e82646f77b31b78eeb0e26db5500930bbd6085d5d5c3844ec27c0ca50"
# scale the server to one process. This may time out initially as the server pulls the image, but watch "flynn -a mongo ps" and it should come up.
flynn -a mongo scale server=1
# mongo should now be running in the cluster at mongo.discoverd:27017
# /config/puma.rb
app = "manabalss" # App-specific
root = "/home/deployer/apps/#{app}"
workers 5
threads 1, 1 # relying on many workers for thread-unsafe apps
rackup DefaultRackup
port 11592
If you are on windows, start by setting up an Ubuntu in a VirtualBox
= http://www.psychocats.net/ubuntu/virtualbox
First you wanna update Ubuntu
$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get dist-upgrade
$ sudo reboot
Add repositories
# in config/puma.rb
app = "cpp" # App-specific
root = "/home/deployer/apps/#{app}"
workers 5
threads 1, 1
#preload_app!
rackup DefaultRackup
#port 9292