Skip to content

Commit

Permalink
Add install of stored procedures
Browse files Browse the repository at this point in the history
  • Loading branch information
SbWereWolf committed Aug 15, 2021
1 parent 5412c78 commit 68192cf
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 20 deletions.
42 changes: 30 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,44 @@
# How To Install
# How To Use
## Direct using by terminal of PostgreSQL service
```bash
# Let suppose the app are installed to /home/ directory
cd /home/fias/
# Run terminal of PostgreSQL
docker-compose -f ./docker/docker-compose.yml exec fias \
psql -U postgres -d fias -w
```
## Using by connect to PostgreSQL service placed inside container
- Adjust port of PostgreSQL service outside of container by
edit the `docker-compose.yml`, at section `ports` define external port
- Run container by command 'sh ./run.sh'
- Connect to PostgreSQL service to ip `0.0.0.0` with early defined
external port, with username `postgres` and empty password
- Use and enjoy address base of FIAS 😀

cd home
# How To Install
```bash
git clone https://github.com/SbWereWolf/fias.git
cd fias
chmod +x ./install.sh
time ./install.sh
time ./run.sh

# Let suppose the base are downloaded to /opt/ directory
time unzip /opt/fias_dbf.zip -d /home/fias/fs/home/fias/base/
find /home/fias/fs/home/fias/base/ -type f -regextype posix-awk \
time unzip /opt/fias_dbf.zip -d ./fias/fs/home/fias/base/ \
&& time find ./fias/fs/home/fias/base/ -type f -regextype posix-awk \
-regex ".*\/(STEAD|NORDOC)([0-9]{2}|[0-9]{4})\.DBF$" -exec rm {} \;

time ./deploy.sh
cd fias
chmod +x ./install.sh && ./install.sh
# at this point we can edit docker-compose.yml
time ./run.sh && time ./deploy.sh
```

# How to Update
```bash
# Let suppose the app are installed to /home/ directory
cd /home/fias/

# Purge destination directiry before unzip update archive
rm -rf ./fs/home/fias/update/*
# Let suppose the update are downloaded to /opt/ directory
unzip /opt/fias_dbf.zip -d /home/fias/fs/home/fias/update/
find /home/fias/fs/home/fias/base/ -type f -regextype posix-awk \
time unzip /opt/fias_delta_dbf.zip -d ./fs/home/fias/update/ \
&& time find ./fs/home/fias/update/ -type f -regextype posix-awk \
-regex ".*\/(STEAD|NORDOC)([0-9]{2}|[0-9]{4})\.DBF$" -exec rm {} \;

time ./update.sh
Expand Down
14 changes: 6 additions & 8 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -217,17 +217,15 @@ STOPSIGNAL SIGINT

EXPOSE 5432

RUN apt-get update \
&& apt-get install -y --no-install-recommends pgdbf;\
rm -rf /var/lib/apt/lists/*;

RUN mkdir -p /home/fias/base/ \
&& mkdir -p /home/fias/update/

COPY ./cmd/ /home/fias/cmd/

RUN find /home/fias/cmd/ -maxdepth 2 -type f -regextype posix-awk \
-regex ".*\/.*.sh$" -exec chmod +x {} \;
-regex ".*\/.*.sh$" -exec chmod +x {} \; \
&& mkdir -p /home/fias/base/ \
&& mkdir -p /home/fias/update/ \
&& apt-get update \
&& apt-get install -y --no-install-recommends pgdbf;\
rm -rf /var/lib/apt/lists/*;

WORKDIR /home/fias/

Expand Down
11 changes: 11 additions & 0 deletions docker/cmd/deploy/deploy-db.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,15 @@ time psql -U postgres -d fias -wab \
-f /home/fias/cmd/deploy/alter-room.sql
date --rfc-3339=seconds && echo 'FINISH alter-room'

date --rfc-3339=seconds && echo 'START create-stored-procedures'
time psql -U postgres -d fias -wab \
-f /home/fias/cmd/deploy/get-address-object-group.sql
time psql -U postgres -d fias -wab \
-f /home/fias/cmd/deploy/get-address-object-name.sql
time psql -U postgres -d fias -wab \
-f /home/fias/cmd/deploy/get-address-object-tree.sql
time psql -U postgres -d fias -wab \
-f /home/fias/cmd/deploy/get-house-name.sql
date --rfc-3339=seconds && echo 'FINISH create-stored-procedures'

echo 'FINISH deploy FIAS'

0 comments on commit 68192cf

Please sign in to comment.