Skip to content

Instantly share code, notes, and snippets.

@yelizariev
Last active September 6, 2019 10:09
Show Gist options
  • Save yelizariev/eddad0f6e78c149059c1 to your computer and use it in GitHub Desktop.
Save yelizariev/eddad0f6e78c149059c1 to your computer and use it in GitHub Desktop.
Ubuntu configuration for odoo development
sudo apt-get update
sudo apt-get install git python-pip htop moreutils tree nginx gimp wmctrl postgresql-server-dev-all
sudo apt-get upgrade
################### Github
# configure ssh keys: https://help.github.com/articles/generating-ssh-keys/
################### Odoo
# download odoo from git:
cd /some/dir/
git clone https://github.com/odoo/odoo.git
# install dependencies:
wget http://nightly.odoo.com/8.0/nightly/deb/odoo_8.0.latest_all.deb
sudo dpkg -i odoo_8.0.latest_all.deb # shows errors -- just ignore them and execute next command:
sudo apt-get -f install
sudo apt-get remove odoo
# install wkhtmltox
cd /usr/local/src
lsb_release -a
uname -i
# check version of your OS and download appropriate package
# http://wkhtmltopdf.org/downloads.html
# e.g.
apt-get install xfonts-base xfonts-75dpi
apt-get -f install
wget http://download.gna.org/wkhtmltopdf/0.12/0.12.2.1/wkhtmltox-0.12.2.1_linux-trusty-amd64.deb
dpkg -i wkhtmltox-*.deb
# requirements.txt
cd /path/to/odoo
sudo pip install -r requirements.txt
sudo pip install watchdog
# fix error with jpeg (if you get it)
# uninstall PIL
sudo pip uninstall PIL
# install libjpeg-dev with apt
sudo apt-get install libjpeg-dev
# reinstall pillow
pip install -I pillow
# (from here https://github.com/odoo/odoo/issues/612 )
# fix issue with lessc
# install Less CSS via nodejs according to this instruction:
# https://www.odoo.com/documentation/8.0/setup/install.html
# create postgres user:
sudo su - postgres -c "createuser -s $USER"
# Create new config file if you don't have it yet:
./openerp-server --save
emacs -nw ~/.openerp_serverrc
# set dbfilter = ^%h$
# create different versions of conf file:
cp ~/.openerp_serverrc ~/.openerp_serverrc-9
cp ~/.openerp_serverrc ~/.openerp_serverrc-8
################### Emacs
# install emacs 24.4+ http://askubuntu.com/questions/437255/how-to-install-emacs-24-4-on-ubuntu
# copy odoo-emacs.el to ~/.emacs
# run emacs:
emacs
# follow instruction at package-list-packages
################### xmodmap
# put xmodmap file to ~/.xmodmap
################### System Keybindings
# download sh scripts from this gist
# make them executable
cd /path/to/scripts/
chmod +x *.sh
# Open Keybindings: All Settings-> Keyboard :: Custom Shortcuts
# Shift+Alt + ...
# S /path/to/scripts/emacs-open-or-activate.sh
# W /path/to/scripts/chrome-open-or-activate.sh
# R /path/to/scripts/terminal-open-or-activate.sh
# F /path/to/scripts/maximize1.sh
# G /path/to/scripts/maximize2.sh
# D - Windows -> close windows
# alt+ctr+del: System -> Lock screen
################### Configure Terminal
# Edit: Profile Preferences
# * initial title: [Terminal]
# * append initial title
# Edit: Keyboard shortcuts -- Shift+Alt+...
# * Untick "enable access menu keys"
# * T - new Tab
# * P - Previous Tab
# * N - Next Tab
# Edit: Scrolling
# * Scrollback: e.g. 10240
# open some tabs in directories you need (e.g. /path/to/odoo, /path/to/addons-yelizariev) and execute:
gnome-terminal --save-config=~/.terminal-tabs
################### /etc/hosts
# check hosts.txt file for example
################### nginx
# put nginx_odoo.conf to /etc/nginx/sites-enabled/
# delete default configuration:
cd /etc/nginx/sites-enabled/
rm default
# restart nginx
sudo /etc/init.d/nginx restart
################### run Odoo
cd /path/to/odoo
git checkout somebranch-or-revision
git tag 8_0-honduras.local
# everytime run odoo this way:
git checkout 8_0-client1.local && ./odoo.py --config=/path/to/.openerp_serverrc-8
# or
git checkout 8_0-project1.local && ./odoo.py --config=/path/to/.openerp_serverrc-8 --auto-reload
# or
git checkout 9_0-project1.local && ./odoo.py --config=/path/to/.openerp_serverrc-9 --dev
# etc.
# then open database you need, e.g. (type http:// explicitly, because browser could understand it as search request)
# http://8_0-client1.local/
# (database name should be 8_0-client1.local )
#!/bin/bash
wmctrl -a ' - Google Chrome' || google-chrome
#!/bin/bash
wmctrl -a 'emacs@ivann' || wmctrl -a 'emacs24@ivann' || emacs24
# /etc/hosts
127.0.0.1 8_0-client1.local
127.0.0.1 8_0-project1.local
127.0.0.1 9_0-project1.local
#!/bin/bash
wmctrl -r ":ACTIVE:" -b remove,maximized_horz
wmctrl -r ":ACTIVE:" -b add,maximized_vert
wmctrl -r ":ACTIVE:" -e 0,0,0,1440,1037
#!/bin/bash
wmctrl -r ":ACTIVE:" -b remove,maximized_horz
wmctrl -r ":ACTIVE:" -b add,maximized_vert
wmctrl -r ":ACTIVE:" -e 0,1220,0,700,1037
server {
listen 80 default_server;
server_name .local;
proxy_buffers 16 64k;
proxy_buffer_size 128k;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
#proxy_redirect http:// https://;
proxy_read_timeout 600s;
client_max_body_size 100m;
location /longpolling {
proxy_pass http://127.0.0.1:8072;
}
location / {
proxy_pass http://127.0.0.1:8069;
}
}
;; -*- mode: Emacs-Lisp; -*-
;; ~/.emacs
;;;; REPOS
(when (>= emacs-major-version 24)
(require 'package)
(package-initialize)
(add-to-list 'package-archives '("marmalade" . "http://marmalade-repo.org/packages/"))
(add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/"))
(setq load-path (cons "/mnt/files/emacs24" load-path))
)
;;;; Common
;; windows
(setq split-width-threshold 140)
;; title
(setq frame-title-format
'("%S" (buffer-file-name "%f"
(dired-directory dired-directory "%b")) " " invocation-name "@" system-name))
;; tool bar
(tool-bar-mode -1)
;; Clipboard
(setq x-select-enable-clipboard t)
(setq interprogram-paste-function 'x-cut-buffer-or-selection-value)
;; ido
(ido-mode t)
;;; VC
(global-set-key "\C-xvd" 'magit-status)
;;;; NOT Programming modes
;;; csv
(require 'csv-mode)
(add-hook 'csv-mode-hook
'(lambda () (csv-align-fields nil (buffer-end -1) (buffer-end +1))))
;;; markdown-mode
(setq auto-mode-alist (cons '("\\.md$" . rst-mode) auto-mode-alist))
;;;; Programming Common
;;; whitespace
(require 'whitespace)
(setq whitespace-style '(
face
trailing
tabs
empty
space-before-tab
tab-mark
))
(add-hook 'emacs-lisp-mode-hook 'whitespace-mode)
(add-hook 'python-mode-hook 'whitespace-mode)
(add-hook 'js3-mode-hook 'whitespace-mode)
(add-hook 'nxml-mode-hook 'whitespace-mode)
(add-hook 'markdown-mode-hook 'whitespace-mode)
;;; flymake
(require 'flymake)
;;; indent
(setq-default tab-width 4)
(setq standard-indent 4)
;;; keys
(defvar my-keys-mode-map (make-keymap) "my-keys-minor-mode keymap.")
(require 'loccur)
(define-key my-keys-mode-map "\C-cr" 'loccur)
(define-key my-keys-mode-map "\C-c\C-r" 'loccur-previous-match)
(define-key my-keys-mode-map "\C-x\C-r" 'rgrep)
(define-minor-mode my-keys-minor-mode
"A minor mode so that my key settings override annoying major modes."
t " mk" my-keys-mode-map)
(my-keys-minor-mode 1)
;;;; Programming modes
;;; python
(require 'flymake-python-pyflakes)
(add-hook 'python-mode-hook 'flymake-python-pyflakes-load)
(setq flymake-python-pyflakes-executable "flake8")
(setq flymake-python-pyflakes-extra-arguments '("--max-line-length=200"))
(add-hook 'python-mode-hook
(lambda () (setq indent-tabs-mode nil)))
;;; css
(require 'flymake-css)
(add-hook 'css-mode-hook 'flymake-css-load)
(setq flymake-css-lint-command "csslint --ignore=adjoining-classes")
;;; js
(setq auto-mode-alist (cons '("\\.js$" . js3-mode) auto-mode-alist))
(require 'flymake-jslint)
(add-hook 'js3-mode-hook 'flymake-jslint-load)
(add-hook 'js3-mode-hook
(lambda ()
(setq indent-tabs-mode nil
js3-indent-level 4
c-basic-offset 4)
))
;;; XML
(add-hook 'nxml-mode-hook
'(lambda()
(setq indent-tabs-mode nil)
(setq nxml-child-indent 4)
(modify-syntax-entry ?' ".")
))
# Open Emacs
# Press Alt-x package-list-packages
# install packages: click i and then x
# some packages require dependencies, that have to be installed via terminal
* flymake
* loccur
* flymake-css
* flymake-jslint
* flymake-python-pyflakes
** sudo pip install flake8
* magit
* js3-mode
#!/bin/bash
wmctrl -a ' - [Terminal]' || gnome-terminal --load-config=~/.terminal-tabs
! ~/.xmodmap
! usage:
! $ xmodmap $HOME/.xmodmap
! Super_L <- Control_L
! Control_R -> Super_R
! caps -> f13
! Menu -> Control_R
remove mod4 = Super_L Super_R
clear Lock
keysym Super_L = Control_L
keysym Super_R = Control_R
!keysym Menu = Control_R
!keycode 66 = F13
!keycode 127 = Menu ! 127=pause
!keycode 94 = Shift_L
!add Lock = Caps_Lock
add mod4 = Super_L
add Control = Control_L Control_R
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment