Unverified Commit b25e0ee2 authored by Lukas Matt's avatar Lukas Matt Committed by GitHub

Merge pull request #12 from thefederationinfo/socialhome_federation_lib

Add socialhome federation repo support
parents edc69d73 63d53927
......@@ -20,19 +20,6 @@ RUN bower install --allow-root
RUN npm -g install grunt
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 start.sh /start.sh
......
#!/bin/bash
if [ "$PROJECT" == "socialhome" ]; then
# fetch user repo
cd /socialhome && git stash \
&& git remote add custom $PRREPO \
&& git fetch custom \
&& git checkout $PRSHA \
&& git stash pop \
&& git log -1 || {
echo "Cannot find $PRREPO $PRSHA"
exit 1
}
if [ "$(basename $PRREPO)" == "socialhome.git" ]; then
cd /socialhome \
&& git remote add custom $PRREPO \
&& git fetch custom \
&& git checkout $PRSHA \
&& git log -1 || {
echo "Cannot find $PRREPO $PRSHA"
exit 1
}
fi
# re-install dependencies
cd /socialhome \
&& pip-sync dev-requirements.txt \
&& npm install \
&& manage.py migrate \
&& 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
# 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/PORT/$PORT/g" /socialhome/.env
cd /socialhome
python manage.py migrate
python manage.py collectstatic
#python manage.py rebuild_index
......
......@@ -70,7 +70,7 @@ function start_app() {
echo "!!!!!!! Custom build active !!!!!!!"
echo "Using repository $PRREPO"
echo "With SHA $PRSHA"
params="-e PRSHA=$PRSHA -e PRREPO=$PRREPO"
params="-e PROJECT=$PROJECT -e PRSHA=$PRSHA -e PRREPO=$PRREPO"
fi
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
......
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