Commit 63d53927 authored by zauberstuhl's avatar zauberstuhl

Add socialhome federation repo support

parent edc69d73
...@@ -20,19 +20,6 @@ RUN bower install --allow-root ...@@ -20,19 +20,6 @@ RUN bower install --allow-root
RUN npm -g install grunt RUN npm -g install grunt
RUN npm run build RUN npm run build
# NOTE workaround for validating localhost domain name
RUN sed -i 's/\\\.//' src/federation/federation/utils/text.py
# NOTE enable key generation in development mode
RUN sed -i 's/SOCIALHOME_GENERATE_USER_RSA_KEYS_ON_SAVE = False/SOCIALHOME_GENERATE_USER_RSA_KEYS_ON_SAVE = True/' config/settings/local.py
# XXX hotfix http fallback support in development mode
# see https://github.com/jaywink/federation/issues/120
RUN sed -i 's/raise_ssl_errors=True/raise_ssl_errors=False/' \
src/federation/federation/utils/network.py
RUN sed -i 's/return "https/return "http/g' \
src/federation/federation/utils/diaspora.py
COPY .env /socialhome/.env COPY .env /socialhome/.env
COPY start.sh /start.sh COPY start.sh /start.sh
......
#!/bin/bash #!/bin/bash
if [ "$PROJECT" == "socialhome" ]; then if [ "$PROJECT" == "socialhome" ]; then
# fetch user repo if [ "$(basename $PRREPO)" == "socialhome.git" ]; then
cd /socialhome && git stash \ cd /socialhome \
&& git remote add custom $PRREPO \ && git remote add custom $PRREPO \
&& git fetch custom \ && git fetch custom \
&& git checkout $PRSHA \ && git checkout $PRSHA \
&& git stash pop \ && git log -1 || {
&& git log -1 || { echo "Cannot find $PRREPO $PRSHA"
echo "Cannot find $PRREPO $PRSHA" exit 1
exit 1 }
} fi
# re-install dependencies # re-install dependencies
cd /socialhome \ cd /socialhome \
&& pip-sync dev-requirements.txt \ && pip-sync dev-requirements.txt \
&& npm install \ && npm install \
&& manage.py migrate \ && manage.py migrate \
&& npm run dev && npm run dev
if [ "$(basename $PRREPO)" == "federation.git" ]; then
rm -vr /socialhome/src/federation \
&& git clone $PRREPO /socialhome/src/federation \
&& cd /socialhome/src/federation \
&& git checkout $PRSHA \
&& git log -1 || {
echo "Cannot find $PRREPO $PRSHA"
exit 1
}
fi
fi fi
# NOTE workaround for validating localhost domain name
sed -i 's/\\\.//' /socialhome/src/federation/federation/utils/text.py
# NOTE enable key generation in development mode
sed -i 's/SOCIALHOME_GENERATE_USER_RSA_KEYS_ON_SAVE = False/SOCIALHOME_GENERATE_USER_RSA_KEYS_ON_SAVE = True/' /socialhome/config/settings/local.py
# XXX hotfix http fallback support in development mode
# see https://github.com/jaywink/federation/issues/120
sed -i 's/raise_ssl_errors=True/raise_ssl_errors=False/' \
/socialhome/src/federation/federation/utils/network.py
sed -i 's/return "https/return "http/g' \
/socialhome/src/federation/federation/utils/diaspora.py
sed -i "s/NAME/$DATABASE/g" /socialhome/.env sed -i "s/NAME/$DATABASE/g" /socialhome/.env
sed -i "s/PORT/$PORT/g" /socialhome/.env sed -i "s/PORT/$PORT/g" /socialhome/.env
cd /socialhome
python manage.py migrate python manage.py migrate
python manage.py collectstatic python manage.py collectstatic
#python manage.py rebuild_index #python manage.py rebuild_index
......
...@@ -70,7 +70,7 @@ function start_app() { ...@@ -70,7 +70,7 @@ function start_app() {
echo "!!!!!!! Custom build active !!!!!!!" echo "!!!!!!! Custom build active !!!!!!!"
echo "Using repository $PRREPO" echo "Using repository $PRREPO"
echo "With SHA $PRSHA" echo "With SHA $PRSHA"
params="-e PRSHA=$PRSHA -e PRREPO=$PRREPO" params="-e PROJECT=$PROJECT -e PRSHA=$PRSHA -e PRREPO=$PRREPO"
fi fi
echo "Starting docker container $1 (thefederation/$3) on port $2" echo "Starting docker container $1 (thefederation/$3) on port $2"
docker run --name=$1 $params -e DATABASE=$1 -e PORT=$2 -p $2:$2 --net=host -d thefederation/$3 docker run --name=$1 $params -e DATABASE=$1 -e PORT=$2 -p $2:$2 --net=host -d thefederation/$3
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment