Commit bab18513 authored by Benjamin Fischer's avatar Benjamin Fischer

[meta] cleanup unused stuff

parent 56683661
{
"cmd": "echo 1",
"targets": {
"less": {
"name": "less",
"cwd": "{FILE_ACTIVE_PATH}",
"cmd": "lessc",
"args": [
"{FILE_ACTIVE_NAME}",
"{FILE_ACTIVE_NAME_BASE}.css",
"--clean-css=--s1 -b",
"--autoprefix"
],
"sh": false
}
}
}
.hgignore
\ No newline at end of file
syntax: glob
*.pyc
.htaccess
*.log
*.DS_Store
conf/*.conf
server.pid
conf/*.ini
var
.settings
.idea
.project
.pydevproject
.metadata
python
tmp
todo.txt
build
dist
*.orig
MANIFEST
hg-check*
vispa.egg*
*.*~
node_modules
docs/source/js
docs/source/py
*.sublime-workspace
.vagrant
vagrant_ansible_inventory_default
node_modules
.atom-build.json
.gitignore
venv
.*
syntax: glob
*.pyc
.htaccess
*.log
*.DS_Store
conf/*.conf
server.pid
conf/*.ini
var
.settings
.idea
.project
.pydevproject
.metadata
python
tmp
todo.txt
build
dist
*.orig
MANIFEST
hg-check*
vispa.egg*
*.*~
node_modules
docs/source/js
docs/source/py
*.sublime-workspace
.vagrant
vagrant_ansible_inventory_default
node_modules
.atom-build.json
.gitignore
d2a44934e2d5611a2a33aa3acf30fff190878c82 0.9.2
433336cdc7bc16650f0ac13acb0bc7781c711991 0.9.3
433336cdc7bc16650f0ac13acb0bc7781c711991 0.9.3
4481eaface3587580ea82bb0f525684ab1330afd 0.9.3
4539b36451458dd22595939903335886267e1c7e 1.0.0
2dd407d89ff39e08198d36c3d4c7bcd277c011ba 1.1.0
f6b9a048610400517521bf79400e65ade826e054 vispa2.0
f6b9a048610400517521bf79400e65ade826e054 vispa2.0
0000000000000000000000000000000000000000 vispa2.0
b230be46a02142ef36a90663923f39f4f1e763ea 2.0.0
b230be46a02142ef36a90663923f39f4f1e763ea 2.0.0
7ccd48ed3f2016af24ca1b64ff11950006b577c6 2.0.0
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
# https://docs.vagrantup.com.
# Every Vagrant development environment requires a box. You can search for
# boxes at https://atlas.hashicorp.com/search.
config.vm.box = "vispa-base.box"
config.vm.box_url = "https://forge.physik.rwth-aachen.de/public/vispa-web/vagrant/vispa-base/vispa-base.box"
# Disable automatic box update checking. If you disable this, then
# boxes will only be checked for updates when the user runs
# `vagrant box outdated`. This is not recommended.
# config.vm.box_check_update = false
# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below,
# accessing "localhost:8080" will access port 80 on the guest machine.
config.vm.network "forwarded_port", guest: 80, host: 8888
# Create a private network, which allows host-only access to the machine
# using a specific IP.
# config.vm.network "private_network", ip: "192.168.33.10"
# Create a public network, which generally matched to bridged network.
# Bridged networks make the machine appear as another physical device on
# your network.
# config.vm.network "public_network"
# Share an additional folder to the guest VM. The first argument is
# the path on the host to the actual folder. The second argument is
# the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options.
# config.vm.synced_folder "../data", "/vagrant_data"
config.vm.synced_folder ".", "/srv/vispa"
# Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options.
# Example for VirtualBox:
#
config.vm.provider "virtualbox" do |vb|
# # Display the VirtualBox GUI when booting the machine
# vb.gui = true
#
# # Customize the amount of memory on the VM:
# vb.memory = "1024"
vb.customize ["modifyvm", :id, "--audio", "none", "--usb", "on", "--usbehci", "off"]
end
#
# View the documentation for the provider you are using for more
# information on available options.
# Define a Vagrant Push strategy for pushing to Atlas. Other push strategies
# such as FTP and Heroku are also available. See the documentation at
# https://docs.vagrantup.com/v2/push/atlas.html for more information.
# config.push.define "atlas" do |push|
# push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME"
# end
# Enable provisioning with a shell script. Additional provisioners such as
# Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
# documentation for more information about their specific syntax and use.
config.vm.provision "ansible" do |ansible|
ansible.playbook = "vagrant/ansible/setup-vispa.yml"
end
end
FROM debian:stretch
# image config
LABEL name="vispa-base"
LABEL version="0.1"
# basic environment variables
ENV PATH /usr/local/bin:/usr/local/sbin:/usr/sbin:/usr/bin:/sbin:/bin:$PATH
ENV LD_LIBRARY_PATH /usr/local/lib:$LD_LIBRARY_PATH
ENV LIBPATH /usr/local/lib:$LIBPATH
ENV PYTHONPATH /usr/local/lib:/usr/local/lib64/python2.7/site-packages:$PYTHONPATH
ENV PKG_CONFIG_PATH /usr/local/lib/pkgconfig:$PKG_CONFIG_PATH
ENV CMAKE_MODULE_PATH /usr/local/etc/cmake:$CMAKE_MODULE_PATH
ENV MANPATH /usr/local/man:$MANPATH
# setup software
RUN apt-get -y update; apt-get clean
RUN apt-get -y install build-essential zip gzip zlib1g-dev libffi-dev libssl-dev libsqlite3-dev \
openssh-server nano wget htop git mercurial python-dev python-setuptools; apt-get clean
RUN DEBIAN_FRONTEND=noninteractive apt-get -y install mysql-server; apt-get clean
RUN easy_install pip
RUN pip install cherrypy
RUN pip install mako
RUN pip install sqlalchemy
RUN pip install -e git+https://github.com/geromueller/rpyc.git@12a53169100bce7175470f959e956f29902fa153#egg=rpyc-dev
RUN pip install alembic
RUN pip install paramiko
RUN pip install pycrypto
RUN pip install ws4py
RUN pip install passlib
# prepare files and directories
RUN mkdir -p /var/run/sshd
# default command
CMD bash
FROM 3pia/vispa-base
# image config
LABEL name="vispa"
LABEL version="0.1"
EXPOSE 4282
EXPOSE 22
# setup vispa
RUN hg clone https://forge.physik.rwth-aachen.de/hg/vispa-web/vispa /home/vispa
RUN cp /home/vispa/conf/cherrypy.ini.sample /home/vispa/conf/cherrypy.ini
# default command
WORKDIR /home/vispa
CMD /usr/sbin/sshd && \
./bin/vispad -c conf -d var -l debug --no-daemon
FROM 3pia/vispa-base
# image config
EXPOSE 4282
EXPOSE 22
LABEL name="vispa"
LABEL version="0.1"
# create the vispa user
RUN echo "vispa\nvispa" | adduser vispa --gecos ""
# download vispa and tweak the config
USER vispa
WORKDIR /home/vispa
RUN hg clone https://forge.physik.rwth-aachen.de/hg/vispa-web/vispa
RUN cd vispa/conf && cp cherrypy.ini.sample cherrypy.ini
# default command
USER root
CMD /usr/sbin/sshd && \
cd vispa && \
su -c "./bin/vispad -c conf --no-daemon -l debug" vispa
{
"cmd": "echo 1",
"targets": {
"less": {
"name": "less",
"cwd": "{FILE_ACTIVE_PATH}",
"cmd": "lessc",
"args": [
"{FILE_ACTIVE_NAME}",
"{FILE_ACTIVE_NAME_BASE}.css",
"--clean-css=--s1 -b",
"--autoprefix"
],
"sh": false
},
"docs": {
"name": "docs",
"cwd": "{PROJECT_PATH}/docs",
"cmd": "make clean && make html 2>&1 | sed 's@docs/source/\\(js/.*\\).rst@vispa/static/\\1.js@g'",
"errorMatch": "(?<file>\\/.+):(?<line>\\d+):\\sERROR:\\s+(?<message>.+(?::\\n.+)?)",
"warningMatch": "(?<file>\\/.+):(?<line>\\d+):\\sWARNING:\\s+(?<message>.+(?::\\n.+)?)"
}
}
}
# -*- coding: utf-8 -*-
"""
Deletes all *.pyc files in 'vispa/' (deep).
It is necessary that 'vispa/' is located one
directory above this script (like ../)!
"""
# Imports
import sys, os
def run():
cwd = os.getcwd()
script = sys.argv[0]
# the abs dir of the project
base_dir = '/'.join(os.path.join(cwd, script).split('/')[:-2])
vispa_dir = os.path.join(base_dir, 'vispa')
extension_dir = os.path.join(base_dir, 'extensions')
# and proceed
dirs = [vispa_dir, extension_dir]
while len(dirs) > 0:
dir = dirs.pop(0)
for elem in os.listdir(dir):
fileorfolder = os.path.join(dir, elem)
if os.path.isdir(fileorfolder):
dirs.append(fileorfolder)
elif fileorfolder.endswith('.pyc'):
os.remove(fileorfolder)
# start the script
if __name__ == '__main__':
run()
\ No newline at end of file
# -*- coding: utf-8 -*-
"""
This script is only able to print sqlite tables!
"""
# Imports
import sys, os
try:
import sqlite3
except Exception, e:
print "The class 'sqlite3' was not found ..."
print "See http://docs.python.org/library/sqlite3.html ..."
sys.exit()
class DBHandler:
"""
This class contains some simple methods to communicate
with a SQLite database. 'sqlite3' is required!
"""
def __init__(self, dbpath):
# connect to the db
try:
self.__connection = sqlite3.connect(dbpath)
# create the cursor executing the queries.
# the cursor is based on the connection
self.__cursor = self.__connection.cursor()
except Exception, e:
print "Could not connect to the database at '"+dbpath+"' ..."
def __del__(self):
del self.__cursor
self.__connection.close()
del self.__connection
def query(self, querystring):
self.__cursor.execute(querystring)
self.__connection.commit()
def getRow(self, querystring, i=0):
self.__cursor.execute(querystring)
j = 0
# this loop checks the dimension of the
# returned data
for row in self.__cursor:
if (j == i):
if (row == None):
return None
else:
return list(row)
else:
j += 1
return None
def getCol(self, querystring, i=0):
self.__cursor.execute(querystring)
returnlist = []
for row in self.__cursor:
# this try block checks the dimension
# of the returned data
try:
returnlist.append(row[i])
except Exception, e:
return None
return returnlist
def getValue(self, querystring, i=0, j=0):
try:
row = self.getRow(querystring, i)
except Exception, e:
return None
try:
returnvalue = row[j]
except Exception, e:
return None
return returnvalue
def getColNames(self, tablename):
return self.getCol("PRAGMA table_info("+tablename+")", 1)
def getTableNames(self, order = ""):
if (order.lower() == "asc"):
order = "ORDER BY name ASC"
elif (order.lower() == "desc"):
order = "ORDER BY name DESC"
return self.getCol("SELECT name FROM sqlite_master WHERE type = 'table' "+order)
def show(self, tablename):
colnames = self.getColNames(tablename)
coldict = {}
linelength = 1
for elem in colnames:
dummycol = self.getCol("SELECT "+elem+" FROM "+tablename)
maxlength = len(elem)
for elem2 in dummycol:
newlength = len(str(elem2))
maxlength = (newlength if newlength > maxlength else maxlength)
coldict[elem] = maxlength
linelength += maxlength+2
makeLine("-", len(tablename)+9, "+", "+")
print "| Table:", tablename, "|"
makeLine("=", linelength, "+", "+"+(lineString("=", len(tablename)+8-linelength, "", "+") if len(tablename)+9 > linelength else ""))
colstring = ""
for elem in colnames:
colstring += elem+lineString(" ", coldict[elem]-len(elem)+2)
print "| "+colstring+"|"
makeLine("-", linelength, "+", "+")
rowscount = self.getValue("SELECT COUNT(*) FROM "+tablename)
allrows = []
for i in range(rowscount):
allrows.append(self.getRow("SELECT * FROM "+tablename, i))
for elem in allrows:
rowstring = ""
i = 0
for elem2 in elem:
rowstring += str(elem2)+lineString(" ", coldict[colnames[i]]-len(str(elem2))+2)
i += 1
print "| "+rowstring+"|"
makeLine("=", linelength, "+", "+")
def showAll(self, order=""):
tables = self.getTableNames(order)
for elem in tables:
self.show(elem)
print "\n"
def lineString(c, n, s1="", s2=""):
line = ""
for i in range(n):
line += c
return s1+line+s2
def makeLine(c, n, s1="", s2=""):
print lineString(c, n, s1, s2)
if __name__ == "__main__":
cwd = os.getcwd()
script = sys.argv[0]
# the abs dir of the project
base_dir = '/'.join(os.path.join(cwd, script).split('/')[:-2])
default_db = os.path.join(base_dir, 'var/db/vispa.db')
try:
dbfile = sys.argv[1]
except:
dbfile = default_db
db = DBHandler(dbfile)
db.showAll()
#!/bin/bash
# call this script using sudo -u vispa-user
# setup your environment here
#export PYTHONPATH=$PYTHONPATH:/usr/local/lib/python2.7/site-packages
# change to the vispa-web root directory
#cd /srv/vispa-web
# activate the sugested python virtualenv
. python/bin/activate
# start the rpc server
# use the -u flag to make the output unbuffered so the
# provided output can be read
python -u vispa/plugins/rpc_main.py
#!/bin/sh
set -e
virtualenv python
. python/bin/activate
pip install mako
pip install cherrypy
pip install sqlalchemy
pip install alembic
pip install pushy
pip install rpyc
[defaults]
remote_tmp=/tmp
forks=20
hostfile=hosts.ini
remote_user=vagrant
ask_pass=True
ask_sudo_pass=True
sudo=True
host_key_checking=False
mysql_root_password: vagrant
nsspam_mysql_password: vagrant
vispa_mysql_password: vagrant
\ No newline at end of file
[vagrant]
localhost ansible_ssh_port=2222
\ No newline at end of file
---
- hosts: webservers
vars:
utf8: true
mysqld:
bind_address: 127.0.0.1
key_buffer: 16M
tasks:
- include: tasks/setup.yml
handlers:
- include: handlers/handlers.yml
- name: ensure python-mysql is installed
apt: pkg=python-mysqldb state=installed
- name: ensure mysql is installed
apt: pkg=mysql-server state=installed
register: mysql_server_installed
- name: ensure mysql is running and starts on boot
service: name=mysql state=started enabled=true
- name: set fact
when: not mysql_root_password
set_fact:
mysql_root_password: vagrant
# 'localhost' needs to be the last item for idempotency, see
# http://ansible.cc/docs/modules.html#mysql-user
- name: set initial mysql root password for all root accounts
when: "mysql_server_installed|changed"
mysql_user: name=root login_user=root login_password="" host={{ item }} password={{mysql_root_password}}
with_items:
- "{{ ansible_hostname }}"
- 127.0.0.1
- ::1
- localhost
- name: copy .my.cnf file with root password credentials
template: src=my.cnf dest=/root/.my.cnf owner=root mode=0600
# 'localhost' needs to be the last item for idempotency, see
# http://ansible.cc/docs/modules.html#mysql-user
- name: update mysql root password for all root accounts
when: "mysql_root_password|mandatory"
mysql_user: name=root host={{ item }} password={{mysql_root_password}}
with_items:
- "{{ ansible_hostname }}"
- 127.0.0.1
- ::1
- localhost
- name: copy .my.cnf file with root password credentials
template: src=my.cnf dest=/root/.my.cnf owner=root mode=0600
- name: ensure anonymous users are not in the database
mysql_user: name='' host={{ item }} state=absent
with_items:
- localhost
- "{{ inventory_hostname }}"
- name: remove the test database
when: "mysql_server_installed|changed and mysql_root_password|mandatory"
mysql_db: name=test state=absent
[client]
{% if utf8 %}
# apply utf8
default-character-set = utf8
{% endif %}
[client]
user=root
password={{mysql_root_password}}
[mysqld]
{% if utf8 %}
# apply utf8
character-set-server = utf8
collation-server = utf8_unicode_ci
{% endif %}
{% if mysqld is not none %}
{% for key, value in mysqld.iteritems() %}
{{ key }}{% if value is not none %}={{ value }}{% endif %}
{% endfor %}
{% endif %}
Name: Mysql authentication
Default: yes
Priority: 512
Auth-Type: Primary
Auth:
[default=1 success=ignore] pam_succeed_if.so quiet uid >= 10000
sufficient pam_mysql.so config_file=/etc/pam-mysql.conf
Auth-Initial:
[default=1 success=ignore] pam_succeed_if.so quiet uid >= 10000
sufficient pam_mysql.so config_file=/etc/pam-mysql.conf
Account-Type: Primary
Account:
[default=1 success=ignore] pam_succeed_if.so quiet uid >= 10000
sufficient pam_mysql.so config_file=/etc/pam-mysql.conf
Account-Initial:
[default=1 success=ignore] pam_succeed_if.so quiet uid >= 10000
sufficient pam_mysql.so config_file=/etc/pam-mysql.conf
# /etc/nsswitch.conf
#
# Example configuration of GNU Name Service Switch functionality.
# If you have the `glibc-doc-reference' and `info' packages installed, try:
# `info libc "Name Service Switch"' for information about this file.
passwd: compat mysql
group: compat mysql
shadow: compat mysql
hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4
networks: files
protocols: db files
services: db files
ethers: db files
rpc: db files
netgroup: nis
- name: pam-auth-update
command: pam-auth-update --force --package
- name: restart unscd
service: name=unscd state=restarted
- name: install pam-mysql
apt: pkg=libpam-mysql state=present
- template: src=pam-mysql.conf.j2 dest=/etc/pam-mysql.conf owner=root group=root mode=600
when: "nsspam_mysql_password|length > 0"