Using for-readline in uwsgi config file doesn't work - uwsgi

I have a problem with uwsgi config file. I try to set env variables using:
for-readline = /home/myuser/envs
env=%(_)
end-for =
cat /home/myuser/envs
DATABASE_NAME=some_name
...
DJANGO_SETTINGS_MODULE=myapp.settings
REDIS_LOCATION=127.0.0.1:6379:0
but it does not work :-( Any idenas?
uwsgi --version
1.9.17.1-debian

for-readline is a >= 2.0.1 option: http://uwsgi-docs.readthedocs.org/en/latest/Changelog-2.0.1.html

Related

How Set Neovim startup directory to Desktop in windows?

I'm using Astro vim distro with neovide. every time I launch neovide / neovim-qt it launches in the directory it's installed on!
OS: windows 10
[Astrovim starting location][1]
[using windows shortcut properties to set start in location][2]
[1]: https://i.stack.imgur.com/ZvXfp.png
[2]: https://i.stack.imgur.com/IEl4N.png
is there a way to set startup location in options.lua ?
Try following code in your configuration file, it make use of vim\neovim autocommands feature:
local os = require("os")
local path_to_desktop = os.getenv("USERPROFILE") .. "\\Desktop"
local vim_enter_group = vim.api.nvim_create_augroup("vim_enter_group", { clear = true })
vim.api.nvim_create_autocmd(
{"VimEnter"},
{ pattern = "*", command = "cd " .. path_to_desktop, group = vim_enter_group }
)
nvim_create_autocmd and nvim_create_group are described in neovim docs. Use :h nvim_create_autocmdto find out more.

Tiny_tds/freetds workaround needed for Heroku

Is there any way currently to install tiny_tds on a rails 7 app in Heroku on the latest stack? All the workarounds seem to be quite old / inoperable. I am trying to get an Azure MSSQL plugin up and running on Heroku.
I have been able to get the buildpack installed, but every time I use TDS (even making a connection via a heroku rails console), I get a timeout error. If I run the exact same command locally, it works.
client = TinyTds::Client.new host: '<host>.database.windows.net', database: "<database>",username: "<username>#<host>.database.windows.net",password: "<password>", port: 1433, azure: tr
ue, tds_version: 7.4, timeout: 300, login_timeout: 300
Adaptive Server connection timed out ([server].database.windows.net:1433)
Additionally, I can run the following successfully on a heroku bash prompt:
~ $ nslookup
> <host>.database.windows.net
Server: <server ip address>
Address: <server ip address>#53
Non-authoritative answer:
<host>.database.windows.net canonical name = <other host name>.eastus.database.windows.net.
<other host name>.eastus.database.windows.net canonical name = <other host name>.trafficmanager.net.
<other host name>.trafficmanager.net canonical name = <another host name>.control.database.windows.net.
Name: <another host name>.control.database.windows.net
Address: <ip address>
~ $ nc -zv <host>.database.windows.net 1433
Connection to <host>.database.windows.net (<ip address>) 1433 port [tcp/ms-sql-s] succeeded!
I have also tried using freetds on heroku (which is required for tinytds) and get timeouts, so I believe the error traces back to freetds' interaction with heroku or the heroku buildpack, of which I have tried a variety of versions (https://github.com/rails-sqlserver/heroku-buildpack-freetds):
On my local macbook, I can run the freetds tsql connection command to connect almost instantaneously to a variety of mssql databases (one on ec2 and two on azure), but the same command times out on heroku bash prompt:
~ $ tsql -H ***.rds.amazonaws.com -p 1433 -U *** -P ***
locale is "en_US.UTF-8"
locale charset is "UTF-8"
using default charset "UTF-8"
103Error 20002 (severity 9):
Adaptive Server connection failed
Error 20002 (severity 9):
Adaptive Server connection failed
There was a problem connecting to the server
FreeTDS version local and remote. I did no special "configuration" file settings other than setting the TDS_VERSION to 7.3 when installing the buildpack on heroku.
# LOCAL:
$ tsql -C
Compile-time settings (established with the "configure" script)
Version: freetds v1.3.13
freetds.conf directory: /opt/homebrew/etc
MS db-lib source compatibility: no
Sybase binary compatibility: yes
Thread safety: yes
iconv library: yes
TDS version: 7.3
iODBC: no
unixodbc: yes
SSPI "trusted" logins: no
Kerberos: yes
OpenSSL: yes
GnuTLS: no
MARS: yes
# Heroku:
$ heroku run bash -a <app>
Running bash on ⬢ <app>... up, run.4557 (Hobby)
~ $ tsql -C
Compile-time settings (established with the "configure" script)
Version: freetds v1.3.13
freetds.conf directory: /app/freetds/etc
MS db-lib source compatibility: no
Sybase binary compatibility: no
Thread safety: yes
iconv library: yes
TDS version: 7.3
iODBC: no
unixodbc: no
SSPI "trusted" logins: no
Kerberos: no
OpenSSL: yes
GnuTLS: no
MARS: yes
Any ideas would be greatly appreciated!
This was due to a TLS/openssl compatibility issue. Using gnutls fixes the issue for now.
Some other notes on the issue:
https://github.com/FreeTDS/freetds/issues/336
https://github.com/FreeTDS/freetds/issues/299
If you need to use freetds on heroku-22, see this pull request.
https://github.com/rails-sqlserver/heroku-buildpack-freetds/pull/20
Many thanks to #engineersmnky for some great questions that led to discovering this answer.

create an EC2 using Chef / knife socket error

I am trying to create an EC2 using knife and knife-ec2 gem
command example :
knife ec2 server create --image ami-f7f03d80 -i --flavor t2.micro -x root -i /root/europe.pem —sud —groups chef-client -Z eu-west-1a -r “role[xmpp]”
Error output :
ERROR: Excon::Errors::SocketError: getaddrinfo: Name or service not known (SocketError)
knife.rb :
log_level :info
log_location STDOUT
node_name 'ec2-user'
client_key '/root/.chef/ec2-user.pem'
validation_client_name 'chef-validator'
validation_key '/etc/chef-server/chef-validator.pem'
chef_server_url 'https://ip-****.eu-west-1.compute.internal:443'
syntax_check_cache_path '/root/.chef/syntax_check_cache'
knife[:aws_access_key_id] = '*****'
knife[:aws_secret_access_key] = '*****'
knife[:region] = 'eu-west-1a'
--
gem list knife-ec2
*** LOCAL GEMS ***
knife-ec2 (0.8.0)
Can any one put me on the right direction, i a m suspecting an issue with the ruby gems.
PS :
for some reason knife ec2 flavor list works fine.
Thanks in advance.
regards,
Amine
>
SOLUTION :
fixed by : - reinstalling the ruby gems - reusing the patched version of ec2 create .rb
That error means it's not able to resolve the hostname I believe. I'd start there.

Determine mysql2 server version using mysql2 Ruby gem

I'm using Rails and the mysql2 gem. Is there a way to get the mysqld server version as running the command:
$ mysqld --version
mysqld Ver 5.5.29 for osx10.8 on i386 (Source distribution)
I do not wish to execute a shell command because the database server might be running on another server.
You can get the version info in rails via ActiveRecord::Base.connection. I'm doing it in my rails console here. I'm using an old version (2.2) of rails so the syntax might be different in yours.
irb(main):001:0> ActiveRecord::Base.connection.select_rows(
"SHOW VARIABLES LIKE '%version%'"
)
=> [
["innodb_version", "5.5.34"],
["protocol_version", "10"],
["slave_type_conversions", ""],
["version", "5.5.34-0ubuntu0.12.04.1"],
["version_comment", "(Ubuntu)"],
["version_compile_machine", "x86_64"],
["version_compile_os", "debian-linux-gnu"]
]
Once you've got this you can pull out the info you want, eg:
version = ActiveRecord::Base.connection
.select_rows("SHOW VARIABLES LIKE 'version'")
.last.last
=> "5.5.34-0ubuntu0.12.04.1"
def mysql_version
mysql_version_sql = 'SHOW VARIABLES WHERE Variable_name = "version"'
ActiveRecord::Base.connection.select_rows(mysql_version_sql)[0][1]
end
mysql_version #=> "5.5.35-0+wheezy1"

puppet tomcat6 service does not receive environment variables

I am using Debian OS and tomcat6.
I export CATALINA_OPTS="-Xms1024m -Xmx2048m" environment variable and create a puppet service:
class tomcat6::service {
service { 'tomcat6':
ensure => running,
hasstatus => true,
hasrestart => true,
enable => true,
}
}
As /usr/share/tomcat6/bin/catalina.sh reads CATALINA_OPTS variables for starting tomcat6 service, the process should receive CATALINA_OPTS but it does not show in the process command. I execute ps aux|grep catalina to show the command detail:
tomcat6 10658 1.0 2.0 2050044 189572 ? Sl 18:04 0:16 /usr/lib/jvm/default- java/bin/java -Djava.util.logging.config.file=/var/lib/tomcat6/conf/logging.properties -Djava.awt.headless=true -Xmx128m -XX:+UseConcMarkSweepGC -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.endorsed.dirs=/usr/share/tomcat6/endorsed -classpath /usr/share/tomcat6/bin/bootstrap.jar -Dcatalina.base=/var/lib/tomcat6 -Dcatalina.home=/usr/share/tomcat6 -Djava.io.tmpdir=/tmp/tomcat6-tomcat6-tmp org.apache.catalina.startup.Bootstrap start
Puppet does not receive CATALINA_OPTS properly.
My question is, how can I let puppet read CATALINA_OPTS when executing puppet tomcat6 service?
Thank you.
instead of
hasstatus => true,
put
hasstatus => false,
By doing this, you will force puppet to look up the proc table and find the daemon OR in other words, this will make puppet run ps auxw | grep tomcat6 before doing anything else.
hasstatus => true tells that if puppet receives a status != running it will do as directed, but in some cases several daemons don't return the status correctly (probably due to mutiple threading involved)
I fixed the issue by setting setenv.sh for tomcat6. It works properly.

Resources