An multiple application pyramid project configuration
Filed under: python
In the deployment of pyramid project, I don’t want to setup a separate process for each pyramid application. So it comes the requirement to deploy multiple application under one project.
Here’s an example configuration for a multiple app project. The project has 2 application, booksearch and mybackup. The configuration file syntax is the same as production.ini which is in paste deploy format. For interpretation of each section see: http://pythonpaste.org/deploy/#composite-applications
webapp-production.ini
[composite:main] use = egg:Paste#urlmap / = home /booksearch = booksearch /mybackup = mybackup [app:booksearch] use = egg:booksearch [app:mybackup] use = egg:mybackup [app:home] use = egg:Paste#static document_root = %(here)s/htdocs [server:main] use = egg:waitress#main host = 127.0.0.1 port = 9090
You can run pserve to start the project:
$pserve webapp-production.ini
Install an OpenVPN server and connect to it on windows
Filed under: linux, security, troubleshooting
Follow the tutorial on linode to install openvpn:
http://library.linode.com/networking/openvpn/debian-6-squeeze
Attention:
Both openvpn and dnsmasq shall be installed on the server.
And on the file /etc/openvpn/server.conf, the following line must be exist and not commented :
push “redirect-gateway def1”
By default the line is :
;push “redirect-gateway def1 bypass-dhcp”
The semi-colon should be removed, and “bypass-dhcp” should be removed too.
redirect-gateway option to configure the VPN as the default gateway (implemented on Linux and Windows only).
redirect-gateway bypass-dhcp option to add a route
allowing DHCP packets to bypass the tunnel, when the
DHCP server is non-local. Currently only implemented
on Windows clients.
Another tip: In the local directive in the begging of server.conf, ip address of your server should be configured:
local 102.83.214.229
On the client, just install OpenVPN GUI on windows, and download client.conf, ca.crt, client1.crt, client2.key to the OpenVPN/Config folder from the VPN server. The config folder is located at C:\Program Files\OpenVPN\config on my system.
And rename client.conf to vpn-server.ovpn (a mandatory step), start OpenVPN client and click connect.
Some faqs:
1.How to tell if openvpn is installed correctly on the sever.
Just run netstat -na|grep 1194 to check whether it is listening, and check whether the process is running by ps. 1194 is the listening port configured at server.conf
2.Why I cann’t telnet to the 1194?
openvpn is an UDP server by default, you can’t telnet to an UDP port.
3.How could I check if my client is connected to the server?
If the OpenVPN tray turn to green, you are connected to the server.
And you can ping the vpn server, if it replies, it is connected:
ping 10.8.0.1
4.Why I could not visit some sites on the world after connected to the openvpn server.
If your local DNS server is polluted and you are not redirect DNS lookup to VPN server, you will still not be able to open the blocked site. On the vpn server, dnsmasq must be installed, and the following exact line exist at server.conf
push “redirect-gateway def1”
5.How could check the route process to a host such as twitter from linux/windows?
on linux: traceroute twitter.com
on windows: tracert twitter.com
You can also run nslookup on windows, and host/digg on linux for debugging.
How to install a network HP printer on Arch linux
Filed under: linux, troubleshooting
The printer package does not work as it should be on my arch for HP laser jet P2035n. It costs me some hour to get it to work. Here’s the steps.
1). Install cups service
pacman -S cups cups-pdf hplip pyqt3 python2-pyqt
pacman -S system-config-printer-gnome
rc.d cups start
2). To add device and install hp driver:
1. Run ‘hp-setup’ as root.
2. Click ‘Show Advanced Options’ button and check-enable ‘Manual Discovery’.
3. Enter IP address 192.168.59.63 in the ‘…device ID…’ entry and click ‘Next’ to install driver.
3). run system-config-printer as root, to add printer
# system-config-printer
click “Add”, Select Device -> Network Printer -> input the IP address of the printer such as “192.168.1.3”, click “Find” -> “Process”
If you encounter the following error:
File “/usr/share/system-config-printer/newprinter.py”, line 1531, in getNetworkPrinterMakeModel
debugprint (host + “: ” + args)
TypeError: cannot concatenate ‘str’ and ‘list’ objects
You should comment out the error line at 1531 of newprinter.py, and then continue to add the printer.
4). Finally, you can run hp-check to see what problems exists for the printer.
Could not chdir to home directory /home/USER: Permission denied
We changed the home folder to /data/home/USER.
When I ssh to our centos server. It shows error “Could not chdir to home directory /home/USER: Permission denied”, however loggin ok. I must manually run cd ~ to go to the home directory.
Googled around, and found it is caused by selinux. The solution:
To disabling selinux or change it from enforcing to permissive.
vi /etc/sysconfig/selinux
change SELINUX from enforcing to permissive: SELINUX=permissive, then reboot.
For server could not be rebooted:
#setenforce permissive
You can check if set correctly
#getenforce











