GithubHelp home page GithubHelp logo

mysociety / commonlib Goto Github PK

View Code? Open in Web Editor NEW
23.0 15.0 25.0 3.78 MB

mySociety code common to several projects

License: Other

Shell 3.33% Perl 24.69% Python 11.45% C++ 0.59% C 0.10% CSS 0.76% JavaScript 4.70% HTML 0.33% PHP 48.16% Makefile 0.22% Ruby 5.67%

commonlib's Introduction

This is the mySociety commonlib repository. It contains libraries which are
shared (or potentially shared) between multiple mySociety sites.

commonlib's People

Contributors

ajparsons avatar crowbot avatar davea avatar dracos avatar evdb avatar garethrees avatar gbp avatar jacksonj04 avatar kagee avatar lizconlan avatar mhl avatar pezholio avatar robinhouston avatar sagepe avatar sebbacon avatar struan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

commonlib's Issues

Don't fallback to [config dir]/packages in install-site.sh

This file is really designed (and maintained) to work on our own deployment system, it's not a generic file that is likely to work on any non-(Debian|Ubuntu) linux. We should error out saying "please contribute a package file" if the target OS is not a supported version Ubuntu or Debian. What is implicit here is that we take a strategy of supporting the current versions of Ubuntu and Debian (and perhaps checking/maintaining this in a more automated way), but don't try to do the automated install on any other linux OS.

read permissions not OK for config file at /home/lmanyonho/fixmystreet/script/../commonlib/perllib/mySociety/Config.pm line 80.

Hi guys I am having an issue while trying to install fixmystret on vagrant in ubuntu 12.04 and the problem is as described above and the line of code being referred to is

# read_config_from_php
# Read configuration data from the named PHP configuration file
sub read_config_from_php($) {
    my ($f) = @_;

    if (! -r $f) {
        throw Error::Simple "$f: read permissions not OK for config file";
    }

rblib: Validate.uses_mixed_capitals should be made unicode-aware

Currently uses_mixed_capitals uses the regular expressions /[A-Z]/ and /[a-z]/ to detect upper and lower case letters. This doesn't take into account non-ASCII upper case and lower case letters. In fixing this, case needs to be taken to preserve Ruby 1.8.7 compatibility, which doesn't have support for Unicode character classes in its regular expressions, meaning that one couldn't just use /[[:upper:]]/, for example.

the user and host parameters to install-site.sh should be optional with --dev

If you specify both --dev and a user (pmo, say) for install-site.sh the results
are unexpected. e.g. if you're logged into a fresh vagrant box as vagrant and
run:

sudo ./install-site.sh --dev pombola pmo pombola.127.0.0.1.xip.io

... then DIRECTORY is set to /home/vagrant and all of /home/vagrant is
chowned to pmo.pmo here:

There's no real use for the USER or HOST options when you're using --dev
so they should be optional.

install-site.sh: $UNIX_USER in crontab

After having installed FixMyStreet with the installation script, I found that I had one (or two?) $UNIX_USER occurrences in the crontab. $UNIX_USER was not set in the environment of our FixMyStreet user, and as such, produced an error.

Be cleverer about workers

Investigate improving the site install script to utilise /proc/cpuinfo to guess a sensible number of workers, and perhaps use gevent, and so on.

Package pinning prevents installing mySociety packages

We set the pinning-priority to 50 but that prevents the updated pdftk (1.44.2+ms) being chosen as the preferred package.

Is this intentional?

# apt-cache policy pdftk
pdftk:
  Installed: (none)
  Candidate: 1.41+dfsg-10+squeeze1
  Version table:
     1.44.2+ms 0
         50 http://debian.mysociety.org/ squeeze/main amd64 Packages
     1.41+dfsg-10+squeeze1 0
        500 http://http.us.debian.org/debian/ squeeze/main amd64 Packages

rblib config unnecessary file checking

Unlike the other language versions, the ruby version checks that the config file exists every time a config variable is looked up, rather than only the first time.

Call to taskset looks distinctly linuxy

Had to hack this call to taskset to work on OSX.

Could this maybe go something like:

        if (exec("uname") eq SOME_DEBIAN_THING) {
            # Using taskset to deal with debian 5 php/mysql extension bug, 
            # by restricting to one processor
            exec('taskset', '0x1', $php_path) or throw Error::Simple "$php_path: exec: $!";
        } else {
            exec($php_path) or throw Error::Simple "$php_path: exec: $!";
        }

install-site.sh can't source site-specific-install.sh in some cases

# Check that we can find the bin or script directory:
if [ -d "$REPOSITORY/bin" ]
then
    BIN_DIRECTORY="$REPOSITORY/bin"
elif [ -d "$REPOSITORY/script" ]
then
    BIN_DIRECTORY="$REPOSITORY/script"
else
    error_msg "No bin or script directory was found in $REPOSITORY"
fi

. "$BIN_DIRECTORY/site-specific-install.sh"

This becomes a problem in rails/ruby apps with both a bin and script directory, which is common (and default in Rails 4). This script finds ./bin and tries to source ./bin/site-specific-install.sh rather than the actual location of the script (./script/site-specific-install.sh).

The installer assumes python2, python3 only server doens't work

Hi.
We are trying to upgrade norways mapit instance in a Debian 11 server.
The problem we encounter is that Debian 11 no longer supports Python2, but all packages that the mapit installer (as initiated by install-site.sh) wants to install is hardcoded to assume python2. Several of the packages no longer exist on Debian, such as python-flup, which needs to be installed using «pip3 install flup-py3».

Is it really not possible to install this on a python3 only server?

Systemd compatibility in install-site.sh

The install-site.sh script restarts nginx by calling /etc/init.d/nginx restart, this should probably be changed to something more future-proof such as /sbin/service nginx restart for systems that have transitioned to systemd units while maintaining backward compatibility with older systems.

The same script also has a install_sysvinit_script() function that might need augmenting or complementing in some way.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.