Add basic LOC SMS support for theo-server machine

This commit is contained in:
Lance Edgar 2020-09-23 15:07:21 -05:00
parent 1b227a8d32
commit 6b88090587
12 changed files with 168 additions and 3 deletions

View file

@ -3,6 +3,7 @@
[catapult-default]
host = ${env.catapult_host}
port = 2638
# https://www.freetds.org/userguide/ChoosingTdsProtocol.html
tds version = 5.0
# this is to allow for product images up to 8MB
text size = 8388608

View file

@ -0,0 +1,13 @@
## -*- mode: conf; -*-
[locsms-default]
host = ${env.locsms_store_server}
% if env.locsms_store_sqlinstance:
instance = ${env.locsms_store_sqlinstance}
% endif
# TODO: the rest of this needs a little polishing
# https://www.freetds.org/userguide/ChoosingTdsProtocol.html
tds version = 7.0
# tds version = 8.0
# port = 1433
# client charset = UTF-8

View file

@ -0,0 +1,7 @@
## -*- mode: conf; -*-
[locsms-default]
Description = LOC SMS
Driver = /usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so
Servername = locsms-default
Database = ${env.locsms_store_dbname}

View file

@ -0,0 +1,14 @@
## -*- mode: conf; -*-
[locsms-default]
Description = LOC SMS
Driver = ODBC Driver 17 for SQL Server
% if env.locsms_store_sqlinstance:
# note, weird port is for named instance (${env.locsms_store_sqlinstance})
# https://docs.microsoft.com/en-us/sql/connect/odbc/linux-mac/connection-string-keywords-and-data-source-names-dsns?view=sql-server-2017
# https://sqlandme.com/2013/05/01/sql-server-finding-tcp-port-number-sql-instance-is-listening-on/
Server = ${env.locsms_store_server},49523
% else:
Server = ${env.locsms_store_server}
% endif
Database = ${env.locsms_store_dbname}

View file

@ -0,0 +1,17 @@
#!/bin/sh -e
# sanity check
if [ "$USER" != 'rattail' ]; then
echo ''
echo "Please run this script as 'rattail' user:"
echo ''
echo " sudo -u rattail $0"
exit 1
fi
cd ${envroot}
RATTAIL='bin/rattail -c app/quiet.conf -P'
$RATTAIL import-locsms --no-versioning --warnings
$RATTAIL import-versions --runas locsms --warnings -m "initial data from LOC SMS"

View file

@ -28,6 +28,9 @@ $RATTAIL --runas corepos import-corepos-api --delete
% elif env.theo_integrates_with == 'catapult':
# Catapult -> Theo
$RATTAIL --runas catapult import-catapult --delete
% elif env.theo_integrates_with == 'locsms':
# LOC SMS -> Theo
$RATTAIL --runas locsms import-locsms --delete
% endif
# make sure version data is correct

View file

@ -5,6 +5,8 @@ extra-index-url =
https://pypi.rattailproject.org/simple/
% if env.theo_integrates_with == 'catapult':
https://${env.restricted_pypi_username}:${env.restricted_pypi_password}@pypi-restricted.rattailproject.org/catapult/
% elif env.theo_integrates_with == 'locsms':
https://${env.restricted_pypi_username}:${env.restricted_pypi_password}@pypi-restricted.rattailproject.org/locsms/
% endif
log-file = ${envroot}/pip.log
exists-action = i

View file

@ -12,6 +12,8 @@
integrate_corepos = true
% elif env.theo_integrates_with == 'catapult':
integrate_catapult = true
% elif env.theo_integrates_with == 'locsms':
integrate_locsms = true
% endif
@ -50,6 +52,20 @@ default.url = catapult://${env.catapult_odbc_username}:${env.catapult_odbc_passw
% endif
## begin locsms
% if env.theo_integrates_with == 'locsms':
<%text>##############################</%text>
# LOC SMS
<%text>##############################</%text>
[locsms.db]
default.url = mssql://${env.locsms_odbc_username}:${env.locsms_odbc_password}@locsms-default
## end locsms
% endif
<%text>##############################</%text>
# rattail
<%text>##############################</%text>
@ -90,6 +106,8 @@ script_location = rattail.db:alembic
version_locations = rattail_corepos.db:alembic/versions rattail.db:alembic/versions
% elif env.theo_integrates_with == 'catapult':
version_locations = rattail_onager.db:alembic/versions rattail.db:alembic/versions
% elif env.theo_integrates_with == 'locsms':
version_locations = rattail_luckysmores.db:alembic/versions rattail.db:alembic/versions
% else:
version_locations = rattail.db:alembic/versions
% endif

View file

@ -82,6 +82,30 @@ $PIP install $QUIET --editable .
## end catapult
% endif
## begin locsms
% if env.theo_integrates_with == 'locsms':
# luckysmores
cd $SRC/luckysmores
git pull $QUIET
find . -name '*.pyc' -delete
$PIP install $QUIET --editable .
# rattail-luckysmores
cd $SRC/rattail-luckysmores
git pull $QUIET
find . -name '*.pyc' -delete
$PIP install $QUIET --editable .
# tailbone-locsms
cd $SRC/tailbone-locsms
git pull $QUIET
find . -name '*.pyc' -delete
$PIP install $QUIET --editable .
## end locsms
% endif
# theo
cd $SRC/theo
git pull $QUIET
@ -96,6 +120,8 @@ $PIP install $QUIET --editable .
$PIP install $QUIET --upgrade --upgrade-strategy eager tailbone-theo[app,corepos]
% elif env.theo_integrates_with == 'catapult':
$PIP install $QUIET --upgrade --upgrade-strategy eager tailbone-theo[app,catapult]
% elif env.theo_integrates_with == 'locsms':
$PIP install $QUIET --upgrade --upgrade-strategy eager tailbone-theo[app,locsms]
% else:
$PIP install $QUIET --upgrade --upgrade-strategy eager tailbone-theo[app]
% endif