Timeless IS is a web-based management software for a franchise of hookah bars called "Timeless Lounge"
Timeless Lounge is currently using a set of software tools were developed around an external application called Poster that is also providing APi to access data. This application is not flexible enough, does not cover all the needs for process automation, therefore there is a need to develop full-fledged information system designed to combine the experience gained in automating processes in lounge bars and support the expansion of the franchise network.
The application should be able to work on any computer displays as well as mobile devices (smartphones and tablets). The interface of the application should be sophisticated, but simple, self-explanatory and intuitive.
A good example on how should be developed the frontend is the GetSling webapp.
Very important for us in case of serious software/hardware failure. The system should not lose/corrupt data (regular database backups) and we should able to restore system performance within 15 minutes (master-slave replication and failover should be configured).
At the following link you can find the updated sketches for the UI/UX part
https://drive.google.com/drive/folders/1f6aH1qlOL5Ek6Zo4b2rW2f6pkDz5jnp9
Always be as pythonic as possible;
PEP-8 is your friend;
It's better to write clear code than good comments;
The right test cycle is:
If you have questions on a task, ask it on the same issue or open a new one;
Use PDD when you couldn't complete a task;
Only submit stable and working PRs;
PLEASE NOTE: when forking, remember to add rultor as collaborator in your private REPO, otherwise we won't be able to merge your contribution (and you won't get paid ;-) )
# Install RVM (for pdd)
curl -sSL https://get.rvm.io | bash -s stable --ruby
gem install pdd
# Download Python
wget https://www.python.org/ftp/python/3.6.7/Python-3.6.7.tgz
tar xvzf Python-3.6.7.tgz
cd Python-3.6.7
./configure
make
make test
sudo make install
# Create workspace and virtual environment
mkdir timelessis-project
mkdir timelessis-project/venv
python3 -m venv timelessis-project/venv
# Clone the repository
cd timelessis-project
git clone https://github.com/<your-github-username>/timelessis.git
cd timelessis
# Activate virtual environment
. ../venv/bin/activate
pip install -r requirements.txt
Debian / Ubuntu repositories include PostgreSQL by default. To install PostgreSQL, use the apt-get (or other apt-driving) command:
sudo apt-get update
sudo apt-get install postgresql-10
If packages are not found, do the following steps:
Create the file /etc/apt/sources.list.d/pgdg.list and add a line for the repository:
sudo deb http://apt.postgresql.org/pub/repos/apt/ {DEBIAN_OR_UBUNTU_VERSION}-pgdg main
NOTE: DEBIAN_OR_UBUNTU_VERSION
is a code name, like trusty
(ubuntu 14.01), xenial
(16.04) and so on.
Import the repository signing key, and update the package lists
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
and then repeat apt-get update
and apt-get install
commands.
sudo -u postgres createuser --superuser timeless_user
sudo -u postgres createdb timelessdb_dev
sudo -u postgres createdb timelessdb_test
psql -U postgres -d timelessdb_dev
> alter user timeless_user with encrypted password 'timeless_pwd';
psql -U timeless_user -d timelessdb_dev
We use Redis for cache storage. For installing Redis:
sudo apt install make gcc libc6-dev tcl
wget http://download.redis.io/redis-stable.tar.gz
tar xvzf redis-stable.tar.gz
cd redis-stable
sudo make install
src/redis-server
Backup scripts (pg_backup.sh
and pg_restore.sh
) are used for save storage of
database. Both of those scripts keep the configuration inside pg_backup.config
file.
Password for those scripts can be provided using standard Postgres methods like
PGPASSWORD
environment variable or ~/.pgpass
file.
Database backups are uploaded to Google Drive. Note that in order to do backup
(and restore), you have to install GDrive
and configure Service Account
credentials. Set SERVICE_ACCOUNT_CREDENTIALS
in pg_backup.config
to the
location of your service account credentials JSON file.
Note that the Google Drive API needs a file ID, not file name, e.g.
FILE_ID=0B-Iak7O9SfIpYk9zTjZvY2xreVU
export FLASK_ENV=testing
pytest
NOTE: To skip integration tests run:
pytest -k 'not it'
python manage.py db migrate
python manage.py db upgrade
export FLASK_APP=main.py
export FLASK_ENV=development
flask run
You should have Docker
and Docker Compose
installed. In other case go through official tutorial to install:
To start up the docker exec the following commands:
docker-compose build
docker-compose up app
and check that http://127.0.0.1:5000/
works.
To run tests execute:
docker-compose run app_test
The file credentials/credentials.json.asc is a JSON file containing all the credentials for the external services used in Timeless IS. This file is decrypted during deploy phase by rultor.
This is the sample file:
{
"credentials": {
"server": {
"staging": {
"address": "...",
"username": "...",
"password": "..."
}
},
"postgres": {
"staging": {
"username": "..."
"password": "..."
}
},
"googledrive": {
"staging": {
"username": "...",
"password": "..."
}
},
"redsms": {
"staging": {
"username": "...",
"password": "..."
}
},
"poster": {
"staging": {
"domain": "...",
"username": "...",
"password": "...",
"token": "..."
}
}
}
}
Under staging.id_rsa and staging.id_rsa.pub are stored the keys to log into the staging server without username and password
See Rultor manual on how to use it decrypted files
You’ll need to have Node 8.10.0 or later on your local development machine. You can use nvm (macOS/Linux) or nvm-windows to easily switch Node versions between different projects.
The React frontend code can be found in "frontend" dir.
There you need to run npm install
.
Then:
npm start
to run the app in development mode.npm test
to run the tests.npm run build
to build the production assets.