Deployment

Getting the code

Check out code from repo:

git clone https://github.com/adshares/adselect.git

Requirements

For a tl;dr solution, please check Quick requirements install for Ubuntu 18.04.

Python

You’ll need Python 2.7. Other versions are untested. It may be already installed on your system, you can check it by typing:

python --version

or

python2.7 --version

You should get something like this:

Python 2.7.15rc1

If you don’t see it, install Python from your system repo.

PIP (Python package manager)

You will also need PIP. It may be already installed on your system, you can check it by typing:

pip --version

You should get something like this:

pip 18.1 from /home/ubuntu/.local/lib/python2.7/site-packages/pip (python 2.7)

If you don’t see it, install PIP from your system repo.

Pipenv

Once you have PIP operational, install pipenv package:

pip install pipenv

Project Python dependencies

You can now use pipenv to install project dependencies.

pipenv install

or for development:

pipenv install --dev

Additional requirements

This project uses MongoDB as a database backend. Installation instructions can be found on the net.

Quick requirements install

The following scripts were designed for Ubuntu 18.04.

git clone https://github.com/adshares/adselect.git
cd adselect
bash scripts/pre-build.sh
bash scripts/pre-install.sh

Start the server

To run the server, simply execute in project directory:

pipenv run python daemon.py

Other deployment configurations

Supervisord

Example Supervisor config file:

[program:adselect]
directory=%(ENV_adselect_ROOT)s
command=pipenv run python daemon.py
pidfile=%(ENV_adselect_ROOT)s/adselect.pid
stdout_logfile=%(ENV_adselect_ROOT)s/adselect.log
stdout_logfile_maxbytes=50MB
stdout_logfile_backups=10
redirect_stderr=true

ENV_adselect_ROOT is the path to the project directory.

Docker

Example Dockerfile:

FROM ubuntu:18.04
RUN apt-get -y install git
RUN git clone https://github.com/adshares/adselect.git /adselect
WORKDIR /adselect

# Install dependencies
RUN bash scripts/pre-build.sh
RUN bash scripts/pre-install.sh

# Build project
RUN bash scripts/build.sh

ENTRYPOINT ["pipenv run python daemon.py"]