Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
H
hivemind
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
hive
hivemind
Commits
cdcefa75
Commit
cdcefa75
authored
4 years ago
by
Andrzej Lisak
Browse files
Options
Downloads
Patches
Plain Diff
[ABW]: CLRF->LF in scripts (was that the reason of CI fail?)
parent
422a8888
No related branches found
No related tags found
2 merge requests
!456
Release candidate v1 24
,
!410
more small changes, get_discussions_by_blog reusing bridge SQL function
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
scripts/ci/hive-sync.sh
+37
-37
37 additions, 37 deletions
scripts/ci/hive-sync.sh
scripts/ci_sync.sh
+62
-62
62 additions, 62 deletions
scripts/ci_sync.sh
with
99 additions
and
99 deletions
scripts/ci/hive-sync.sh
+
37
−
37
View file @
cdcefa75
#!/bin/bash
#!/bin/bash
set
-euo
pipefail
set
-euo
pipefail
# For debug only!
# For debug only!
# RUNNER_HIVEMIND_SYNC_MAX_BLOCK=10000
# RUNNER_HIVEMIND_SYNC_MAX_BLOCK=10000
# RUNNER_HIVED_URL='{"default":"http://hived-node:8091"}'
# RUNNER_HIVED_URL='{"default":"http://hived-node:8091"}'
# RUNNER_HIVED_URL='{"default":"http://172.17.0.1:8091"}'
# RUNNER_HIVED_URL='{"default":"http://172.17.0.1:8091"}'
hive_sync
()
{
hive_sync
()
{
# Start hive sync process
# Start hive sync process
cat
<<
EOF
cat
<<
EOF
Starting hive sync using hived url:
${
RUNNER_HIVED_URL
}
.
Starting hive sync using hived url:
${
RUNNER_HIVED_URL
}
.
Max sync block is:
${
RUNNER_HIVEMIND_SYNC_MAX_BLOCK
}
.
Max sync block is:
${
RUNNER_HIVEMIND_SYNC_MAX_BLOCK
}
.
EOF
EOF
USER
=
${
RUNNER_POSTGRES_APP_USER
}
:
${
RUNNER_POSTGRES_APP_USER_PASSWORD
}
USER
=
${
RUNNER_POSTGRES_APP_USER
}
:
${
RUNNER_POSTGRES_APP_USER_PASSWORD
}
OPTIONS
=
"host=
${
RUNNER_POSTGRES_HOST
}
&port=
${
RUNNER_POSTGRES_PORT
}
"
OPTIONS
=
"host=
${
RUNNER_POSTGRES_HOST
}
&port=
${
RUNNER_POSTGRES_PORT
}
"
DATABASE_URL
=
"postgresql://
${
USER
}
@/
${
HIVEMIND_DB_NAME
}
?
${
OPTIONS
}
"
DATABASE_URL
=
"postgresql://
${
USER
}
@/
${
HIVEMIND_DB_NAME
}
?
${
OPTIONS
}
"
hive
sync
\
hive
sync
\
--log-mask-sensitive-data
\
--log-mask-sensitive-data
\
--pid-file
hive_sync.pid
\
--pid-file
hive_sync.pid
\
--test-max-block
=
${
RUNNER_HIVEMIND_SYNC_MAX_BLOCK
}
\
--test-max-block
=
${
RUNNER_HIVEMIND_SYNC_MAX_BLOCK
}
\
--exit-after-sync
\
--exit-after-sync
\
--test-profile
=
False
\
--test-profile
=
False
\
--steemd-url
"
${
RUNNER_HIVED_URL
}
"
\
--steemd-url
"
${
RUNNER_HIVED_URL
}
"
\
--prometheus-port
11011
\
--prometheus-port
11011
\
--database-url
"
${
DATABASE_URL
}
"
\
--database-url
"
${
DATABASE_URL
}
"
\
--mock-block-data-path
mock_data/block_data/follow_op/mock_block_data_follow.json mock_data/block_data/community_op/mock_block_data_community.json mock_data/block_data/reblog_op/mock_block_data_reblog.json
\
--mock-block-data-path
mock_data/block_data/follow_op/mock_block_data_follow.json mock_data/block_data/community_op/mock_block_data_community.json mock_data/block_data/reblog_op/mock_block_data_reblog.json
\
--community-start-block
4999998
\
--community-start-block
4999998
\
2>&1 |
tee
-i
hivemind-sync.log
2>&1 |
tee
-i
hivemind-sync.log
}
}
hive_sync
hive_sync
This diff is collapsed.
Click to expand it.
scripts/ci_sync.sh
+
62
−
62
View file @
cdcefa75
#!/bin/bash
#!/bin/bash
set
-e
set
-e
set
-o
pipefail
set
-o
pipefail
HIVEMIND_DB_NAME
=
$1
HIVEMIND_DB_NAME
=
$1
HIVEMIND_POSTGRESQL_CONNECTION_STRING
=
$2
HIVEMIND_POSTGRESQL_CONNECTION_STRING
=
$2
HIVEMIND_SOURCE_HIVED_URL
=
$3
HIVEMIND_SOURCE_HIVED_URL
=
$3
HIVEMIND_MAX_BLOCK
=
$4
HIVEMIND_MAX_BLOCK
=
$4
HIVEMIND_HTTP_PORT
=
$5
HIVEMIND_HTTP_PORT
=
$5
HIVEMIND_ENABLE_DB_MONITORING
=
${
6
:-
yes
}
HIVEMIND_ENABLE_DB_MONITORING
=
${
6
:-
yes
}
PYTHONUSERBASE
=
./local-site
PYTHONUSERBASE
=
./local-site
DB_NAME
=
${
HIVEMIND_DB_NAME
//-/_
}
DB_NAME
=
${
HIVEMIND_DB_NAME
//-/_
}
DB_NAME
=
${
DB_NAME
//\[/_
}
DB_NAME
=
${
DB_NAME
//\[/_
}
DB_NAME
=
${
DB_NAME
//]/_
}
DB_NAME
=
${
DB_NAME
//]/_
}
DB_URL
=
$HIVEMIND_POSTGRESQL_CONNECTION_STRING
/
$DB_NAME
DB_URL
=
$HIVEMIND_POSTGRESQL_CONNECTION_STRING
/
$DB_NAME
echo
Corrected db name
$DB_NAME
echo
Corrected db name
$DB_NAME
echo
Corrected db url
$DB_URL
echo
Corrected db url
$DB_URL
# Reuse DB_NAME as name of symbolic link pointing local hive "binary".
# Reuse DB_NAME as name of symbolic link pointing local hive "binary".
HIVE_NAME
=
$DB_NAME
HIVE_NAME
=
$DB_NAME
if
[
-f
hive_sync.pid
]
;
then
if
[
-f
hive_sync.pid
]
;
then
kill
-SIGINT
`
cat
hive_sync.pid
`
||
true
;
kill
-SIGINT
`
cat
hive_sync.pid
`
||
true
;
rm
hive_sync.pid
;
rm
hive_sync.pid
;
fi
fi
kill
-SIGINT
`
pgrep
-f
"
$HIVE_NAME
sync"
`
||
true
;
kill
-SIGINT
`
pgrep
-f
"
$HIVE_NAME
sync"
`
||
true
;
sleep
5
sleep
5
kill
-9
`
pgrep
-f
"
$HIVE_NAME
sync"
`
||
true
;
kill
-9
`
pgrep
-f
"
$HIVE_NAME
sync"
`
||
true
;
kill
-SIGINT
`
pgrep
-f
"
$HIVE_NAME
server"
`
||
true
;
kill
-SIGINT
`
pgrep
-f
"
$HIVE_NAME
server"
`
||
true
;
sleep
5
sleep
5
kill
-9
`
pgrep
-f
"
$HIVE_NAME
server"
`
||
true
;
kill
-9
`
pgrep
-f
"
$HIVE_NAME
server"
`
||
true
;
fuser
$HIVEMIND_HTTP_PORT
/tcp
-k
-INT
||
true
fuser
$HIVEMIND_HTTP_PORT
/tcp
-k
-INT
||
true
sleep
5
sleep
5
fuser
$HIVEMIND_HTTP_PORT
/tcp
-k
-KILL
||
true
fuser
$HIVEMIND_HTTP_PORT
/tcp
-k
-KILL
||
true
sleep
5
sleep
5
ls
-l
dist/
*
ls
-l
dist/
*
rm
-rf
./local-site
rm
-rf
./local-site
mkdir
-p
`
python3
-m
site
--user-site
`
mkdir
-p
`
python3
-m
site
--user-site
`
python3 setup.py
install
--user
--force
python3 setup.py
install
--user
--force
ln
-sf
./local-site/bin/hive
$HIVE_NAME
ln
-sf
./local-site/bin/hive
$HIVE_NAME
./
$HIVE_NAME
-h
./
$HIVE_NAME
-h
echo
Attempting to recreate database
$DB_NAME
echo
Attempting to recreate database
$DB_NAME
psql
-U
$POSTGRES_USER
-h
localhost
-d
postgres
-c
"DROP DATABASE IF EXISTS
$DB_NAME
;"
psql
-U
$POSTGRES_USER
-h
localhost
-d
postgres
-c
"DROP DATABASE IF EXISTS
$DB_NAME
;"
if
[
"
$HIVEMIND_ENABLE_DB_MONITORING
"
=
"yes"
]
;
then
if
[
"
$HIVEMIND_ENABLE_DB_MONITORING
"
=
"yes"
]
;
then
psql
-U
$POSTGRES_USER
-h
localhost
-d
postgres
-c
"CREATE DATABASE
$DB_NAME
TEMPLATE template_monitoring;"
psql
-U
$POSTGRES_USER
-h
localhost
-d
postgres
-c
"CREATE DATABASE
$DB_NAME
TEMPLATE template_monitoring;"
else
else
psql
-U
$POSTGRES_USER
-h
localhost
-d
postgres
-c
"CREATE DATABASE
$DB_NAME
"
psql
-U
$POSTGRES_USER
-h
localhost
-d
postgres
-c
"CREATE DATABASE
$DB_NAME
"
fi
fi
echo
Attempting to starting hive
sync
using hived node:
$HIVEMIND_SOURCE_HIVED_URL
.
Max
sync
block is:
$HIVEMIND_MAX_BLOCK
echo
Attempting to starting hive
sync
using hived node:
$HIVEMIND_SOURCE_HIVED_URL
.
Max
sync
block is:
$HIVEMIND_MAX_BLOCK
echo
Attempting to access database
$DB_URL
echo
Attempting to access database
$DB_URL
./
$HIVE_NAME
sync
--pid-file
hive_sync.pid
--test-max-block
=
$HIVEMIND_MAX_BLOCK
--exit-after-sync
--test-profile
=
False
--steemd-url
"
$HIVEMIND_SOURCE_HIVED_URL
"
--prometheus-port
11011
--database-url
$DB_URL
--mock-block-data-path
mock_data/block_data/follow_op/mock_block_data_follow.json mock_data/block_data/community_op/mock_block_data_community.json mock_data/block_data/reblog_op/mock_block_data_reblog.json
--community-start-block
4999998 2>&1 |
tee
-i
hivemind-sync.log
./
$HIVE_NAME
sync
--pid-file
hive_sync.pid
--test-max-block
=
$HIVEMIND_MAX_BLOCK
--exit-after-sync
--test-profile
=
False
--steemd-url
"
$HIVEMIND_SOURCE_HIVED_URL
"
--prometheus-port
11011
--database-url
$DB_URL
--mock-block-data-path
mock_data/block_data/follow_op/mock_block_data_follow.json mock_data/block_data/community_op/mock_block_data_community.json mock_data/block_data/reblog_op/mock_block_data_reblog.json
--community-start-block
4999998 2>&1 |
tee
-i
hivemind-sync.log
rm
hive_sync.pid
rm
hive_sync.pid
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment