• Stars
    star
    237
  • Rank 169,885 (Top 4 %)
  • Language
    Python
  • License
    GNU Affero Genera...
  • Created over 13 years ago
  • Updated about 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Hasjob, the Hasgeek job board

Hasjob

Code for Hasjob, Hasgeek’s job board at https://hasjob.co/

Copyright © 2010-2021 by Hasgeek

Hasjob’s code is open source under the AGPL v3 license (see LICENSE.txt). We welcome your examination of our code to:

  • Establish trust and transparency on how it works, and
  • Allow contributions to Hasjob.

Our workflow assumes this code is for use on a single production website. Using this to operate your own job board is not recommended. The name ‘Hasjob’ and the distinctive appearance of the job board are not part of the open source code.

To establish our intent, we use the AGPL v3 license, which requires you to release all your modifications to the public under the same license. You may not make a proprietary fork. To have your contributions merged back into the master repository, you must agree to assign copyright to Hasgeek, and must assert that you have the right to make this assignment. (You may not like this condition, and we understand. If you have a better idea, tell us!)

Installation

Installation is a multi-step process. If any of this is outdated, consult the .travis.yml file. That tends to be better maintained.

Pick an environment

Hasjob requires a FLASK_ENV environment variable set to one of the following values, depending on whether the deployment is in development or production:

  • DEVELOPMENT or development or dev (default)
  • PRODUCTION or production or prod

In a production environment, you must set FLASK_ENV globally for it to be available across processes. On Ubuntu/Debian systems, add it to /etc/environment and reboot.

PostgreSQL, Redis, NodeJS

Hasjob requires PostgreSQL, Redis and NodeJS. Installation

On macOS using Homebrew:

$ brew install postgresql
$ brew services start postgresql
$ brew install redis
$ brew services start redis
$ brew install node

On Ubuntu:

  • PostgreSQL:

    $ sudo apt install postgresql
    $ sudo systemctl enable postgresql@13-main
    
  • Redis: sudo apt install redis

  • NodeJS: Follow instructions at https://node.dev/node-binary

Next, create a PostgreSQL DB. On macOS:

$ createdb hasjob

On any Linux distribution:

$ sudo -u postgres createuser -d hasgeek
$ sudo -u postgres createdb -O hasgeek hasjob

Edit instance/development.py to set the variable SQLALCHEMY_DATABASE_URI to one of these, depending on whether the database is hosted under the hasgeek user or your personal account, and whether your database is accessed over a Unix socket or IP:

  1. postgresql:///hasjob
  2. postgresql://localhost/hasjob
  3. postgresql://hasgeek:YOUR_PASSWORD_HERE@localhost:5432/hasjob

Redis does not require special configuration, but must listen on localhost and port 6379 (default).

Configuration

Hasjob requires several configuration variables. Copy instance/settings-sample.py into a new file named either instance/development.py or instance/production.py depending on runtime environment, and set all values.

Hasjob operates as a client app of Funnel (previously Lastuser before it merged into Funnel). You must either run Funnel yourself, in parallel with Hasjob, or register as a client on the production website at https://hasgeek.com/apps.

Hasjob makes use of subdomains to serve different sub-boards for jobs. To set it up for development:

  • Edit /etc/hosts and add these entries:

    127.0.0.1    hasjob.test
    127.0.0.1    static.hasjob.test
    127.0.0.1    www.hasjob.test
    129.0.0.1    your-test-subboard.hasjob.test
    
  • Edit instance/development.py and change SERVER_NAME to 'hasjob.test:5001'

Install dependencies

Hasjob runs on Python 3.7 or later with the Flask microframework.

Virutalenv + pip + webpack

If you are going to use a computer on which you would work on multiple Python based projects, Virtualenv is strongly recommended to ensure Hasjob’s elaborate and sometimes version-specific requirements doesn't clash with anything else.

You will need to install all the requirements listed in requirements.txt using pip:

$ pip install -r requirements.txt

If you intend to actively contribute to Hasjob code, some functionality is sourced from the related libraries coaster, baseframe and Flask-Lastuser. You may want to clone these repositories separately and put them in development mode:

$ cd ..
$ git clone https://github.com/hasgeek/coaster.git
$ git clone https://github.com/hasgeek/baseframe.git
$ git clone https://github.com/hasgeek/flask-lastuser.git
$ pip uninstall coaster baseframe flask-lastuser
$ for DIR in coaster baseframe flask-lastuser; do cd $DIR; python setup.py develop; cd ..; done
$ cd baseframe && make && cd ..

You will need to install all dependencies, run Webpack to bundle CSS, JS files & generate the service-worker.js

$ cd <hasjob project root>
$ make

Before you run the server in development mode, make sure you have Postgres server and Redis server running as well. To start Hasjob:

$ ./runserver.sh

Create root board

Some functionality in Hasjob requires the presence of a sub-board named www. Create it by visiting http://hasjob.test:5001/board (or the /board page on whatever hostname and port you used for your installation). The www board is a special-case to refer to the root website.

Periodic jobs

Hasjob requires some tasks to be run in periodic background jobs. These can be called from cron. Use crontab -e as the user account running Hasjob and add:

*/10 * * * * cd /path/to/hasjob; flask periodic sessions
*/5  * * * * cd /path/to/hasjob; flask periodic impressions
0    2 * * * cd /path/to/hasjob; flask periodic campaignviews

Other notes

If you encounter a problem setting up, please look at existing issue reports on GitHub before filing a new issue. This code is the same version used in production, so if the website works, chances are something is wrong in your installation.

WSGI is recommended for production. For Apache, enable mod_wsgi and make a VirtualHost with:

WSGIScriptAlias / /path/to/hasjob/git/repo/folder/wsgi.py

For Nginx, run wsgi.py under uWSGI and proxy to it:

location / {
    include uwsgi_params; # Include common uWSGI settings here
    uwsgi_pass 127.0.0.1:8093;  # Use the port number uWSGI is running on
    uwsgi_param UWSGI_CHDIR /path/to/hasjob/git/repo/folder;
    uwsgi_param UWSGI_MODULE wsgi;
}

Sample uWSGI configuration:

[uwsgi]
socket = 127.0.0.1:8093
processes = 8
threads = 2
enable-threads = True
master = true
uid = <user-account-on-your-server>
gid = <group-for-user-account>
chdir = /path/to/hasjob/git/repo/folder
virtualenv = /path/to/virtualenv
plugins-dir = /usr/lib/uwsgi/plugins
plugins = python37
pp = ..
wsgi-file = wsgi.py
callable = application
touch-reload = /path/to/file/to/touch/to/cause/reload
pidfile = /var/run/uwsgi/%n.pid
daemonize = /var/log/uwsgi/app/%n.log

More Repositories

1

lastuser

Lastuser has been merged into Funnel. This repository is archived.
Python
166
star
2

coaster

Common patterns for Flask apps
Python
69
star
3

funnel

Website for hasgeek.com
Python
46
star
4

hacknight

HasGeek Hacknights
JavaScript
35
star
5

doctypehtml5

Website source for doctypehtml5.in
HTML
19
star
6

events

Hasgeek's legacy event database
CSS
19
star
7

flask-lastuser

Flask extension for Lastuser
Python
17
star
8

hasgeek.tv

Hasgeek TV
Python
16
star
9

eventframe

Eventframe
Python
16
star
10

baseframe

Baseframe for Hasgeek projects
JavaScript
11
star
11

pennywise

Web-based double-entry accounting
Python
11
star
12

boxoffice

Ticketing
JavaScript
10
star
13

50p-handbook

The 50p Handbook with GitBooks
8
star
14

jsfoo

JSFoo 2012-2016 websites
JavaScript
7
star
15

kharcha

Expense tracker
Python
6
star
16

internship-test-android

Android test for HasGeek's internship.
Java
6
star
17

public-lists

6
star
18

flask-commentease

Comments and voting as a Flask extension
Python
6
star
19

hasweb

HasGeek's website (obsolete; see hasgeek/funnel for current website)
HTML
5
star
20

peopleflow

Peopleflow tracks participation and attendance at HasGeek events.
Python
5
star
21

hgapp

Hasgeek App Boilerplate
Python
5
star
22

jsfoo-edition-1

Website for jsfoo.in
CSS
5
star
23

geekup

Geekup.in source code
JavaScript
4
star
24

metarefresh

Meta Refresh website
HTML
4
star
25

fifthelephant

The Fifth Elephant
JavaScript
4
star
26

github-hook

GitHub commit hook using Flask and Python
Python
4
star
27

droidcon

Droidcon India
HTML
4
star
28

confrouter

Conference Router Project
Shell
3
star
29

rootconf

Rootconf Website
CSS
3
star
30

androidcamp

Website for androidcamp.in
Ruby
3
star
31

android

HasGeek's android app.
Java
3
star
32

hascore

Hasgeek legacy geonames API
Python
3
star
33

zalebi

HasGeek on the go
Java
2
star
34

hasnew

HasGeek News
Python
2
star
35

hasgeek.github.com

HasGeek Code page
HTML
2
star
36

paystation

PayStation
JavaScript
2
star
37

serverdown

Standby page for server downtime
HTML
2
star
38

hasjob-kiosk-app

A PoC for ChromeOS Kiosk App
JavaScript
1
star
39

hasdev

HasGeek development environment and project management
Python
1
star
40

internship-test-python-flask

Python+Flask test for HasGeek's internship
HTML
1
star
41

contactpoint

ContactPoint
Python
1
star
42

billgate

HasGeek Billing Gateway
Python
1
star
43

phpcloud

Website for Scaling PHP in the Cloud
CSS
1
star
44

dukaan

HasGeek Shop
Python
1
star
45

clonedoattend

Clone events on DoAttend and update event name and dates
Python
1
star
46

outreach

HasGeek Outreach
Python
1
star
47

nodular

Reusable content objects for HasGeek apps
Python
1
star
48

cartonama2012

Cartonama
JavaScript
1
star
49

kulfi

New HasGeek Android App, replacing Zalebi
Java
1
star
50

av-doc

Documentation for AV at HasGeek events
HTML
1
star