Add basic LOC SMS support for theo-server machine
This commit is contained in:
parent
1b227a8d32
commit
6b88090587
|
@ -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
|
|
@ -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
|
|
@ -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}
|
|
@ -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}
|
17
machines/theo-server/deploy/theo-common/import-locsms-first.sh.mako
Executable file
17
machines/theo-server/deploy/theo-common/import-locsms-first.sh.mako
Executable 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"
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -29,6 +29,7 @@ env.timezone = 'America/Chicago'
|
|||
env.theo_integrates_with = None
|
||||
#env.theo_integrates_with = 'corepos'
|
||||
#env.theo_integrates_with = 'catapult'
|
||||
#env.theo_integrates_with = 'locsms'
|
||||
|
||||
# default admin user credentials for Theo web app
|
||||
env.theo_admin_username = 'username'
|
||||
|
@ -91,3 +92,33 @@ env.catapult_host = 'INSTANCE.catapultweboffice.com'
|
|||
# these credentials are used to access the ODBC DSN for ECRS Catapult
|
||||
env.catapult_odbc_username = 'username'
|
||||
env.catapult_odbc_password = 'password'
|
||||
|
||||
|
||||
##############################
|
||||
# LOC SMS
|
||||
##############################
|
||||
|
||||
# this is the hostname (or IP) for your SMS store server
|
||||
env.locsms_store_server = 'locsms-server.example.com'
|
||||
|
||||
# this is your SMS SQL Server "instance" name, if applicable
|
||||
env.locsms_store_sqlinstance = None
|
||||
#env.locsms_store_sqlinstance = 'SQLEXPRESS'
|
||||
|
||||
# this is your SMS DB name
|
||||
env.locsms_store_dbname = 'STORESQL'
|
||||
|
||||
# these credentials are used to access the ODBC DSN for LOC SMS
|
||||
env.locsms_odbc_username = 'username'
|
||||
env.locsms_odbc_password = 'password'
|
||||
|
||||
# which ODBC driver to use? note that 'mssql' is generally recommended where
|
||||
# possible, however is not selected by default b/c it is not open source, and
|
||||
# can be trickier to get working in some situations
|
||||
# https://docs.sqlalchemy.org/en/13/dialects/mssql.html#driver-unicode-support
|
||||
# cf. also this issue at https://github.com/microsoft/msphpsql/issues/1112
|
||||
env.locsms_odbc_driver = 'freetds'
|
||||
#env.locsms_odbc_driver = 'mssql'
|
||||
|
||||
# if using the 'mssql' driver, you must also accept its EULA
|
||||
env.mssql_driver_accept_eula = False
|
||||
|
|
39
machines/theo-server/fabfile.py
vendored
39
machines/theo-server/fabfile.py
vendored
|
@ -76,9 +76,27 @@ def bootstrap_base(c):
|
|||
# which cause it to use too much memory, so we use a more stable branch
|
||||
from rattail_fabric2 import freetds
|
||||
freetds.install_from_source(c, user='rattail', branch='Branch-1_2')
|
||||
deploy(c, 'rattail/freetds.conf.mako', '/usr/local/etc/freetds.conf',
|
||||
deploy(c, 'rattail/catapult/freetds.conf.mako', '/usr/local/etc/freetds.conf',
|
||||
use_sudo=True, context={'env': env})
|
||||
deploy(c, 'rattail/odbc.ini', '/etc/odbc.ini', use_sudo=True)
|
||||
deploy(c, 'rattail/catapult/odbc.ini', '/etc/odbc.ini', use_sudo=True)
|
||||
|
||||
# locsms extras
|
||||
elif env.theo_integrates_with == 'locsms':
|
||||
apt.install(c, 'unixodbc', 'unixodbc-dev')
|
||||
|
||||
# mssql odbc
|
||||
if env.locsms_odbc_driver == 'mssql':
|
||||
from rattail_fabric2 import mssql
|
||||
mssql.install_mssql_odbc(c, accept_eula=env.mssql_driver_accept_eula)
|
||||
deploy(c, 'rattail/locsms/mssql/odbc.ini.mako', '/etc/odbc.ini',
|
||||
use_sudo=True, context={'env': env})
|
||||
|
||||
else: # freetds odbc
|
||||
apt.install(c, 'tdsodbc')
|
||||
deploy(c, 'rattail/locsms/freetds/freetds.conf.mako', '/etc/freetds/freetds.conf',
|
||||
use_sudo=True, context={'env': env})
|
||||
deploy(c, 'rattail/locsms/freetds/odbc.ini.mako', '/etc/odbc.ini',
|
||||
use_sudo=True, context={'env': env})
|
||||
|
||||
|
||||
@task
|
||||
|
@ -134,6 +152,8 @@ def install_theo_app(c, envname, production, port, from_source=False,
|
|||
pkgname = 'tailbone-theo[app,corepos]'
|
||||
elif env.theo_integrates_with == 'catapult':
|
||||
pkgname = 'tailbone-theo[app,catapult]'
|
||||
elif env.theo_integrates_with == 'locsms':
|
||||
pkgname = 'tailbone-theo[app,locsms]'
|
||||
else:
|
||||
pkgname = 'tailbone-theo[app]'
|
||||
c.sudo("bash -c 'PIP_CONFIG_FILE={0}/pip.conf cd {0} && bin/pip install {1}'".format(envroot, pkgname),
|
||||
|
@ -180,6 +200,10 @@ def install_theo_app(c, envname, production, port, from_source=False,
|
|||
deploy(c, 'theo-common/import-catapult-first.sh.mako', '{}/app/import-catapult-first.sh'.format(envroot),
|
||||
use_sudo=True, owner='rattail:', mode='0755',
|
||||
context={'envroot': envroot})
|
||||
elif env.theo_integrates_with == 'locsms':
|
||||
deploy(c, 'theo-common/import-locsms-first.sh.mako', '{}/app/import-locsms-first.sh'.format(envroot),
|
||||
use_sudo=True, owner='rattail:', mode='0755',
|
||||
context={'envroot': envroot})
|
||||
|
||||
# theo db
|
||||
if not postgresql.db_exists(c, dbname):
|
||||
|
@ -213,6 +237,9 @@ def install_theo_app(c, envname, production, port, from_source=False,
|
|||
elif env.theo_integrates_with == 'catapult':
|
||||
c.sudo("bash -c 'cd {} && bin/rattail -c app/quiet.conf --runas theo make-user --no-password catapult'".format(envroot),
|
||||
user='rattail')
|
||||
elif env.theo_integrates_with == 'locsms':
|
||||
c.sudo("bash -c 'cd {} && bin/rattail -c app/quiet.conf --runas theo make-user --no-password locsms'".format(envroot),
|
||||
user='rattail')
|
||||
|
||||
# supervisor
|
||||
deploy(c, 'theo-common/supervisor.conf.mako', '/etc/supervisor/conf.d/{}.conf'.format(safename),
|
||||
|
@ -247,11 +274,17 @@ def install_theo_source(c, envroot):
|
|||
install_source_package(c, envroot, 'tailbone-corepos')
|
||||
|
||||
# catapult
|
||||
if env.theo_integrates_with == 'catapult':
|
||||
elif env.theo_integrates_with == 'catapult':
|
||||
install_source_package(c, envroot, 'onager', restricted=True)
|
||||
install_source_package(c, envroot, 'rattail-onager', restricted=True)
|
||||
install_source_package(c, envroot, 'tailbone-onager', restricted=True)
|
||||
|
||||
# locsms
|
||||
elif env.theo_integrates_with == 'locsms':
|
||||
install_source_package(c, envroot, 'luckysmores', restricted=True)
|
||||
install_source_package(c, envroot, 'rattail-luckysmores', restricted=True)
|
||||
install_source_package(c, envroot, 'tailbone-locsms', restricted=True)
|
||||
|
||||
# theo
|
||||
install_source_package(c, envroot, 'theo')
|
||||
|
||||
|
|
Loading…
Reference in a new issue