sudo apt install zsh-autosuggestions zsh-syntax-highlighting zsh
The go
command line tool needs to be able to fetch dependencies from your private GitLab, but authenticaiton is required.
This assumes your private GitLab is hosted at privategitlab.company.com
.
The following environment variables are recommended:
export GO111MODULE=on
export GOPRIVATE=privategitlab.company.com
FROM ruby:2.3.1 | |
# Install dependencies | |
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs | |
# Set an environment variable where the Rails app is installed to inside of Docker image: | |
ENV RAILS_ROOT /var/www/app_name | |
RUN mkdir -p $RAILS_ROOT | |
# Set working directory, where the commands will be ran: |
# 1.4 on ubuntu 14.04 | |
wget https://mirrors.tuna.tsinghua.edu.cn/erlang-solutions/ubuntu/pool/esl-erlang_19.2-1~ubuntu~trusty_amd64.deb | |
sudo dpkg -i esl-erlang_19.2-1~ubuntu~trusty_amd64.deb | |
sudo apt-get -f -y install | |
sudo dpkg -i esl-erlang_19.2-1~ubuntu~trusty_amd64.deb | |
wget https://mirrors.tuna.tsinghua.edu.cn/erlang-solutions/ubuntu/pool/elixir_1.4.1-1~ubuntu~trusty_all.deb | |
sudo dpkg -i elixir_1.4.1-1~ubuntu~trusty_all.deb | |
elixir -v | |
# 1.5 on ubuntu 14.04 |
#!/usr/bin/env bash | |
# --slave /usr/bin/$1 $1 /usr/bin/$1-\${version} \\ | |
function register_clang_version { | |
local version=$1 | |
local priority=$2 | |
update-alternatives \ | |
--install /usr/bin/llvm-config llvm-config /usr/bin/llvm-config-${version} ${priority} \ |
#!/usr/bin/env python | |
# visit https://www.childs.be/blog/post/how-to-run-a-python-script-as-a-service-in-background-as-a-daemon for instructions | |
# uses https://raw.githubusercontent.com/metachris/python-posix-daemon/master/src/daemon2x.py | |
import time, sys, logging | |
from daemon2x import Daemon | |
# Logging | |
logging.basicConfig( filename='/var/log/daemon-example.log', | |
filemode='a', |
If you have any sort of administrative interface on your web site, you can easily imagine an intruder gaining access and mucking about. How do you know the extent of the damage? Adding an audit log to your app is one quick solution. An audit log should record a few things:
Using the Rails framework, this is as simple as adding a before_action
to your admin controllers. Here’s a basic version that I’m using in production.
一路过来也部署过3、4个Rails App了,其中也使用过mina等远程部署项目,但每次去部署新的App还是会遇到一些大大小小问题。最近和几个朋友正在做一个应用,在部署的过程中又被自己坑了~所以今天准备总结一下,方便自己未来的部署之路,也方便Rails新手学习使用。
#####环境说明 因为Linux的发型版太多,所以不能一一举例,经过自己的实践体验,发现Ubuntu可以更轻松的部署您的Rails App(个人看法,曾经在Centos下部署,遇到了好多坑)。所以该博文将基于以下的部署环境。
What is Redis?
Redis is an open source, advanced in-memory key-value store. It is often referred to as a data structure server since keys can contain strings, hashes, lists, sets and sorted sets.
######1. If you're running OS X, install redis in terminal using Homebrew :
brew install redis
######2. Add the redis and hiredis gems to the project's Gemfile (remember to bundle install
after you do this) :
This brief guide is written from my own experience with migrating a large (~5GB) MySQL database to PostgreSQL for a Rails project.
No warranties, guarantees, support etc. Use at your own risk and, as always, ENSURE YOU MAKE BACKUPS FIRST!
I chose [pgloader
][1] because it's extremely fast. YMMV.
mysql2
gem with pg
in Gemfile
.config/database.yml
for PostgreSQL. I used [Rails' template][2] as a starting point.