Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F12034
run-devcentral.sh
No One
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
dereckson
Nov 8 2015, 13:54
2015-11-08 13:54:25 (UTC+0)
Size
2 KB
Referenced Files
None
Subscribers
None
run-devcentral.sh
View Options
#!/bin/sh
INSTANCE_NAME
=
devcentral
DOMAIN
=
$INSTANCE_NAME
.nasqueron.org
DATA_DIRECTORY
=
/data/
$INSTANCE_NAME
MYSQL_INSTANCE
=
acquisitariat
PHABRICATOR_URL
=
http://
$DOMAIN
PHABRICATOR_TITLE
=
"Nasqueron DevCentral"
PHABRICATOR_ALT_FILE_DOMAIN
=
"http://phabricator-files-for-devcentral-nasqueron.spacetechnology.net"
REPO_LOGIN
=
git
REPO_HOST
=
bitbucket.org
PHABRICATOR_PROD_REPO
=
"ssh://git@bitbucket.org/nasqueron/devcentral-phabricator"
PHABRICATOR_PROD_BRANCH
=
production
# Checks container isn't running
docker-container-status
$INSTANCE_NAME
> /dev/null
if
[
"
$?
"
-lt
2
]
;
then
echo
"Container is already running."
echo
"To force relaunch, try docker stop
$INSTANCE_NAME
; docker rm
$INSTANCE_NAME
;
$0
"
exit
1
fi
# Create container
docker run -t -d
\
--link
$MYSQL_INSTANCE
:mysql
\
-v
$DATA_DIRECTORY
/repo:/var/repo
\
-v
$DATA_DIRECTORY
/conf:/opt/phabricator/conf
\
-p
31080
:80
\
-e
PHABRICATOR_URL
=
$PHABRICATOR_URL
\
-e
PHABRICATOR_TITLE
=
"
$PHABRICATOR_TITLE
"
\
-e
PHABRICATOR_ALT_FILE_DOMAIN
=
"
$PHABRICATOR_ALT_FILE_DOMAIN
"
\
-e
PHABRICATOR_PROD_REPO
=
$PHABRICATOR_PROD_REPO
\
-e
PHABRICATOR_PROD_BRANCH
=
$PHABRICATOR_PROD_BRANCH
\
--name
$INSTANCE_NAME
nasqueron/phabricator
# Phabricator setup
docker
exec
$INSTANCE_NAME
sh -c
'cd /opt/phabricator && \
bin/config set mysql.host mysql && \
bin/config set mysql.pass $MYSQL_ENV_MYSQL_ROOT_PASSWORD && \
bin/config set phabricator.base-uri $PHABRICATOR_URL && \
bin/config set security.alternate-file-domain "$PHABRICATOR_ALT_FILE_DOMAIN" && \
bin/config set mailgun.domain $DOMAIN && \
rm -f /etc/nginx/sites-enabled/default && \
chown -R app /var/repo'
# Deploys our version
# As we change static resources, restart php-fpm is a good idea: if someone asks
# the page while we were pulling our version, the old celerity map would be kept
# by APCu.
docker
exec
$INSTANCE_NAME
sh -c
'mkdir -p /root/.ssh && \
cp /opt/phabricator/conf/deploy-keys/* /root/.ssh'
docker
exec
$INSTANCE_NAME
ssh -o
StrictHostKeyChecking
=
no
${
REPO_LOGIN
}
@
${
REPO_HOST
}
docker
exec
$INSTANCE_NAME
sh -c
'cd /opt/phabricator && \
git remote add private "$PHABRICATOR_PROD_REPO" && \
git fetch --all && \
git checkout $PHABRICATOR_PROD_BRANCH && \
sv restart php-fpm'
# Fixes bug phd doesn't run at the very first container launch
# docker exec $INSTANCE_NAME sv restart phd
echo
"Deployment done at `date`."
exit
0
File Metadata
Details
Attached
Mime Type
text/plain; charset=utf-8
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
10720
Default Alt Text
run-devcentral.sh (2 KB)
Attached To
Mode
P122 run-devcentral.sh
Attached
Detach File
Event Timeline
Log In to Comment