Skip to content

Commit

Permalink
appserver
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Albuquerque authored and Daniel Albuquerque committed Jul 31, 2020
1 parent 71097a0 commit ed2a262
Show file tree
Hide file tree
Showing 12 changed files with 207 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ DBACCESS_SERVER=protheus_dbaccess
DBACCESS_ALIAS=PROTHEUS
DBACCESS_PORT=7890

PROTHEUS_DATA_PATH=./totvs12/protheus_data
PROTHEUS_APO_PATH=./totvs12/protheus/apo/
PROTHEUS_DATA_PATH=./protheus12/protheus_data
PROTHEUS_APO_PATH=./protheus12/protheus/apo/
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
*.tgz
*.tar.gz
docker/protheus12/*
5 changes: 2 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ services:
appserver:
build: ./docker/totvs-appserver-docker
ports:
- 8081:8081
- 8080:8080
- 9999:9999
user: root
environment:
- DBACCESS_SERVER=${DBACCESS_SERVER}
Expand All @@ -48,6 +47,6 @@ services:
- ${PROTHEUS_APO_PATH}:/totvs12/protheus/apo
depends_on:
- dbaccess

volumes:
dbdata: {}
7 changes: 7 additions & 0 deletions docker/totvs-appserver-docker/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Dockerfile
.dockerignore
.git
./midia
./totvs-downloads
./totvs11
prepare-totvs11-rootfs.sh
1 change: 1 addition & 0 deletions docker/totvs-appserver-docker/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.ZIP
Binary file not shown.
36 changes: 36 additions & 0 deletions docker/totvs-appserver-docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
FROM centos:7

LABEL maintainer "Enderson Maia <[email protected]>"

RUN yum -y update \
&& yum -y install \
dmidecode \
fontconfig \
glib2 \
glibc \
libstdc++ \
libuuid \
wget \
&& rm -rf /var/cache/yum/* \
&& yum clean all

RUN DUMB_INIT_SHA256="37f2c1f0372a45554f1b89924fbb134fc24c3756efaedf11e07f599494e0eff9" \
&& wget -O /usr/bin/dumb-init https://github.com/Yelp/dumb-init/releases/download/v1.2.2/dumb-init_1.2.2_amd64 \
&& echo "37f2c1f0372a45554f1b89924fbb134fc24c3756efaedf11e07f599494e0eff9 */usr/bin/dumb-init" | sha256sum -c - \
&& chmod +x /usr/bin/dumb-init

COPY /build /build

ADD 20-07-15-P12_APPSERVER_BUILD-19.3.0.5_LINUX_X64.TAR.GZ /totvs12/protheus/bin/appserver

RUN /build/setup.sh

EXPOSE 9999

VOLUME ["/totvs12/protheus_data", "/totvs12/protheus/apo/"]

WORKDIR /totvs12/protheus/bin/appserver

ENTRYPOINT [ "/usr/bin/dumb-init", "--" ]

CMD [ "/usr/local/bin/my-init.sh" ]
19 changes: 19 additions & 0 deletions docker/totvs-appserver-docker/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
USER = endersonmaia
NAME = $(USER)/totvs-appserver
VERSION = 17.3.0.13

.PHONY: all
all: build

.PHONY: build
build:
docker image build -t $(NAME):$(VERSION) --rm .

.PHONY: tag_latest
tag_latest:
docker image tag $(NAME):$(VERSION) $(NAME):latest

.PHONY: release
release:
docker image push $(NAME):$(VERSION)
docker image push $(NAME):latest
52 changes: 52 additions & 0 deletions docker/totvs-appserver-docker/build/appserver.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
[drivers]
active=tcp

[tcp]
type=tcpip
port=9999

[environment]
SourcePath=/totvs12/protheus/apo/
RootPath=/totvs12/protheus_data/
StartPath=/system/
x2_path=
RpoDb=Top
RpoLanguage=portuguese
RpoVersion=120
LocalFiles=ctree
Trace=0
localdbextension=.dtc
PictFormat=DEFAULT
DateFormat=DEFAULT

TOPDataBase=MSSQL
TOPServer={{DBACCESS_SERVER}}
TOPALIAS={{DBACCESS_ALIAS}}
TOPMEMOMEGA=1

FWTRACELOG=1
StartSysInDB=1

[LockServer]
Enable=0
;Server=127.0.0.1
Port=1234

[General]
;CanAcceptFSRemote=1
InstallPath=/totvs12/protheus/bin/appserver
CONSOLELOG=1
ConsoleFile=console.log
MaxStringSize=10
BuildKillUsers=1

[LICENSECLIENT]
SERVER=license
PORT=5555
LOGMESSAGES=0

[SSLCONFIGURE]
SSL2=1
SSL3=1
TLS1=2
Verbose=0
22 changes: 22 additions & 0 deletions docker/totvs-appserver-docker/build/my-init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env bash

set -e
set -x

# Configurando DBAccess
export DBACCESS_SERVER=${DBACCESS_SERVER:-${DBACCESS_PORT_7890_TCP_ADDR}}
export DBACCESS_ALIAS=${DBACCESS_ALIAS:-protheus}
export DBACCESS_PORT=${DBACCESS_PORT:-7890}

/bin/sed 's/{{DBACCESS_SERVER}}/'"${DBACCESS_SERVER}"'/' -i /totvs12/protheus/bin/appserver/appserver.ini
/bin/sed 's/{{DBACCESS_ALIAS}}/'"${DBACCESS_ALIAS}"'/' -i /totvs12/protheus/bin/appserver/appserver.ini
/bin/sed 's/{{DBACCESS_PORT}}/'"${DBACCESS_PORT}"'/' -i /totvs12/protheus/bin/appserver/appserver.ini

# Aguardando conectividade com o dbaccess
until echo -n > /dev/tcp/${DBACCESS_SERVER}/${DBACCESS_PORT}
do
echo "Esperando serviço do dbaccess..."
sleep 0.5
done

exec "/totvs12/protheus/bin/appserver/appsrvlinux"
19 changes: 19 additions & 0 deletions docker/totvs-appserver-docker/build/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash
set -e
set -x

TOTVS_PATH=/totvs12

mkdir -p $TOTVS_PATH/protheus/{apo,bin/appserver}

cd $TOTVS_PATH/protheus/bin/appserver/

chmod 777 $TOTVS_PATH/protheus/bin/appserver/*.so

echo $TOTVS_PATH/"protheus/bin/appserver/" > /etc/ld.so.conf.d/appserver64-libs.conf
/sbin/ldconfig

cp /build/my-init.sh /usr/local/bin/my-init.sh
cp /build/appserver.ini $TOTVS_PATH/protheus/bin/appserver/

rm -rf /build
46 changes: 46 additions & 0 deletions docker/totvs-appserver-docker/notes.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
- totvs11microsigaprotheus-server-11.0-1.i586.rpm
- totvs11microsigaprotheus-rpo-all-top-por-11.0-1.i586.rpm
- totvs11microsigaprotheus-systemload-bra-11.0-1.i586.rpm
- totvs11microsigaprotheus-systemload-general-por-11.0-1.i586.rpm
- totvs11microsigaprotheus-data-11.0-1.i586.rpm

Não instalei o hlppo, HELP é desnecessário aqui :

- totvs11microsigaprotheus-systemload-bra-hlppor-11.0-1.i586.rpm

Remover pastas `desnecessárias` para gerar imagem menor

protheus_data/samples/
protheus/bin/smarclient/
protheus/my\ projects/

* Processo de atualização da imagem

Um forma de executar o processo de atualização do container é usar alguma diretiva
ONBUILD e verificar se existe algo numa pasta ou volume /update que contenhas as atualizações
este processo iria descompactar os arquivos, e substituir o conteúdo da pasta de :

* binários
* rop
* include
* libs
* updates
* etc


ulimit -n 32768
ulimit -s 1024
ulimit -m 2048000
ulimit -v 2048000


$ ./appsrvlinux --help

opcao --help invalida!

-daemon: executa em background
-log_server: executa como servidor de logs
-balance_smart_client_desktop: executa como proxy para smart client desktop
-balance_html: executa como proxy para html
-balance_telnet: executa como proxy telnet
-balance_web_services: executa como proxy web services

0 comments on commit ed2a262

Please sign in to comment.