Skip to content
GitLab
Explore
Sign in
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
48d62fe6
Commit
48d62fe6
authored
6 years ago
by
roadscape
Browse files
Options
Downloads
Patches
Plain Diff
support for external postgres
parent
03998f3f
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Dockerfile
+2
-0
2 additions, 0 deletions
Dockerfile
scripts/entrypoint.sh
+31
-14
31 additions, 14 deletions
scripts/entrypoint.sh
scripts/hivesynccontinue.sh
+24
-0
24 additions, 0 deletions
scripts/hivesynccontinue.sh
with
57 additions
and
14 deletions
Dockerfile
+
2
−
0
View file @
48d62fe6
...
...
@@ -50,8 +50,10 @@ WORKDIR /app
ADD
scripts/entrypoint.sh /usr/local/bin/entrypoint.sh
ADD
scripts/hivesync.sh /usr/local/bin/hivesync.sh
ADD
scripts/hivesynccontinue.sh /usr/local/bin/hivesynccontinue.sh
RUN
chmod
+x /usr/local/bin/entrypoint.sh
RUN
chmod
+x /usr/local/bin/hivesync.sh
RUN
chmod
+x /usr/local/bin/hivesynccontinue.sh
RUN
\
pip3
install
.
&&
\
...
...
This diff is collapsed.
Click to expand it.
scripts/entrypoint.sh
+
31
−
14
View file @
48d62fe6
...
...
@@ -5,7 +5,9 @@
# a non-micro-fork was encountered. Hive has a startup routine which attempts
# to recover automatically, so database should be kept intact between restarts.
# eb need to set: RUN_IN_EB, S3_BUCKET, SYNC_TO_S3 (boolean) if a syncer
# eb with self-contained postgres need to set: RUN_IN_EB, S3_BUCKET, and SYNC_TO_S3 (boolean) if a syncer
# eb with external postgres do not require RUN_IN_EB, S3_BUCKET, or SYNC_TO_S3
# with external postgres need to set: SYNC_SERVICE if a syncer
# hive expects: DATABASE_URL, LOG_LEVEL, STEEMD_URL, JUSSI_URL
# default DATABASE_URL should be postgresql://postgres:postgres@localhost:5432/postgres
...
...
@@ -65,24 +67,39 @@ if [[ "$RUN_IN_EB" ]]; then
service postgresql restart
fi
fi
cd
$APP_ROOT
# startup hive
echo
hivemind: starting
sync
exec
"
${
POPULATE_CMD
}
"
sync
2>&1&
cd
$APP_ROOT
# startup hive
echo
hivemind: starting
sync
exec
"
${
POPULATE_CMD
}
"
sync
2>&1&
echo
hivemind: starting server
if
[[
!
"
$SYNC_TO_S3
"
]]
;
then
exec
"
${
POPULATE_CMD
}
"
server
echo
hivemind: starting server
if
[[
!
"
$SYNC_TO_S3
"
]]
;
then
exec
"
${
POPULATE_CMD
}
"
server
else
exec
"
${
POPULATE_CMD
}
"
server
--log-level
=
warning 2>&1&
mkdir
-p
/etc/service/hivesync
cp
/usr/local/bin/hivesync.sh /etc/service/hivesync/run
chmod
+x /etc/service/hivesync/run
echo
hivemind: starting hivesync service
runsv /etc/service/hivesync
fi
else
exec
"
${
POPULATE_CMD
}
"
server
--log-level
=
warning 2>&1&
# start hive with an external postgres
cd
$APP_ROOT
if
[[
"
$SYNC_SERVICE
"
]]
;
then
echo
hivemind: starting
sync
exec
"
${
POPULATE_CMD
}
"
sync
2>&1&
echo
hivemind: starting server
exec
"
${
POPULATE_CMD
}
"
server 2>&1&
# make sure hive sync and server continually run
mkdir
-p
/etc/service/hivesync
cp
/usr/local/bin/hivesync.sh /etc/service/hivesync/run
cp
/usr/local/bin/hivesync
continue
.sh /etc/service/hivesync/run
chmod
+x /etc/service/hivesync/run
echo
hivemind: starting hivesync service
runsv /etc/service/hivesync
else
echo
hivemind: starting server
exec
"
${
POPULATE_CMD
}
"
server
fi
fi
echo
hivemind: application has stopped, see log
for
errors
This diff is collapsed.
Click to expand it.
scripts/hivesynccontinue.sh
0 → 100644
+
24
−
0
View file @
48d62fe6
#!/bin/bash
POPULATE_CMD
=
"
$(
which hive
)
"
HIVESYNC_PID
=
`
pgrep
-f
'hive sync'
`
if
[[
!
$?
-eq
0
]]
;
then
echo
NOTIFYALERT! hivemindsync quit unexpectedly, restarting hive sync...
cd
$APP_ROOT
exec
"
${
POPULATE_CMD
}
"
sync
2>&1&
fi
sleep
30
HIVESERVER_PID
=
`
pgrep
-f
'hive server'
`
if
[[
!
$?
-eq
0
]]
;
then
echo
NOTIFYALERT! hivemindserver quit unexpectedly, restarting hive server...
cd
$APP_ROOT
exec
"
${
POPULATE_CMD
}
"
server 2>&1&
fi
# prevent flapping
sleep
120
\ No newline at end of file
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