Skip to content

Commit b792b30

Browse files
committed
Add support for WireCloud 1.3
1 parent 8db8e56 commit b792b30

14 files changed

Lines changed: 931 additions & 0 deletions

1.3/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/elasticsearch-data/
2+
/postgres-data/
3+
/wirecloud-instance/
4+
/wirecloud-static/

1.3/Dockerfile

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
FROM python:3.6-stretch
2+
3+
MAINTAINER WireCloud Team <wirecloud@conwet.com>
4+
5+
ENV DEFAULT_THEME=wirecloud.defaulttheme
6+
ENV FORWARDED_ALLOW_IPS=*
7+
ENV DB_HOST=
8+
ENV DB_PORT=5432
9+
ENV LOGLEVEL=info
10+
11+
RUN apt-get update && \
12+
apt-get install -y libmemcached-dev gosu && \
13+
pip install --no-cache-dir social-auth-app-django "gunicorn==19.3.0" "psycopg2==2.6" pylibmc pysolr "elasticsearch==2.4.1" && \
14+
rm -rf /var/lib/apt/lists/* && \
15+
gosu nobody true
16+
17+
# Install WireCloud & dependencies
18+
RUN pip install --no-cache-dir "wirecloud<1.4"
19+
20+
COPY ./docker-entrypoint.sh /
21+
COPY ./manage.py /usr/local/bin/
22+
23+
RUN adduser --system --group --shell /bin/bash wirecloud && \
24+
pip install --no-cache-dir channels asgi_ipc asgi_redis asgi_rabbitmq && \
25+
mkdir -p /opt/wirecloud_instance /var/www/static && \
26+
cd /opt && \
27+
wirecloud-admin startproject wirecloud_instance wirecloud_instance && \
28+
chown -R wirecloud:wirecloud wirecloud_instance /var/www/static && \
29+
chmod a+x wirecloud_instance/manage.py
30+
31+
COPY ./settings.py ./urls.py /opt/wirecloud_instance/wirecloud_instance/
32+
33+
WORKDIR /opt/wirecloud_instance
34+
35+
VOLUME /var/www/static
36+
VOLUME /opt/wirecloud_instance/data
37+
38+
EXPOSE 8000
39+
40+
HEALTHCHECK --interval=3s \
41+
--start-period=40s \
42+
CMD curl --fail http://localhost:8000/api/features || exit 1
43+
44+
ENTRYPOINT ["/docker-entrypoint.sh"]

1.3/docker-compose-config-file.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
version: "3"
2+
3+
services:
4+
5+
nginx:
6+
restart: always
7+
image: nginx:latest
8+
ports:
9+
- 80:80
10+
volumes:
11+
- ./nginx.conf:/etc/nginx/nginx.conf:ro
12+
- ./wirecloud-static:/var/www/static:ro
13+
depends_on:
14+
- wirecloud
15+
16+
17+
postgres:
18+
restart: always
19+
image: postgres:latest
20+
environment:
21+
- POSTGRES_PASSWORD=wirepass # Change this password!
22+
volumes:
23+
- ./postgres-data:/var/lib/postgresql/data
24+
25+
26+
elasticsearch:
27+
restart: always
28+
image: elasticsearch:2.4
29+
volumes:
30+
- ./elasticsearch-data:/usr/share/elasticsearch/data
31+
command: elasticsearch -Des.index.max_result_window=50000
32+
33+
34+
memcached:
35+
restart: always
36+
image: memcached:1
37+
command: memcached -m 2048m
38+
39+
40+
wirecloud:
41+
restart: always
42+
image: fiware/wirecloud:1.3
43+
depends_on:
44+
- postgres
45+
- elasticsearch
46+
- memcached
47+
environment:
48+
- DEBUG=False
49+
# - DEFAULT_THEME=wirecloud.defaulttheme
50+
- DB_HOST=postgres
51+
- DB_PASSWORD=wirepass # Change this password!
52+
- FORWARDED_ALLOW_IPS=*
53+
- ELASTICSEARCH2_URL=http://elasticsearch:9200/
54+
- MEMCACHED_LOCATION=memcached:11211
55+
# Uncomment the following environment variables to enable IDM integration
56+
#- FIWARE_IDM_SERVER=${FIWARE_IDM_SERVER}
57+
#- SOCIAL_AUTH_FIWARE_KEY=${SOCIAL_AUTH_FIWARE_KEY}
58+
#- SOCIAL_AUTH_FIWARE_SECRET=${SOCIAL_AUTH_FIWARE_SECRET}
59+
volumes:
60+
- ./wirecloud-data:/opt/wirecloud_instance/data
61+
- ./wirecloud-static:/var/www/static
62+
- ./settings.py:/opt/wirecloud_instance/wirecloud_instance/settings.py:ro

1.3/docker-compose-custom-user.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
version: "3"
2+
3+
services:
4+
5+
wirecloud:
6+
restart: always
7+
image: fiware/wirecloud:1.3
8+
# If you want to use a user from the host, provide here the id of the
9+
# user, e.g. `export WIRECLOUD_USER=$(id -u username)`
10+
user: ${WIRECLOUD_USER:-0}
11+
ports:
12+
- 80:8000
13+
environment:
14+
- DEBUG=True
15+
volumes:
16+
- ./wirecloud-data:/opt/wirecloud_instance/data
17+
- ./wirecloud-static:/var/www/static

1.3/docker-compose-idm.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
version: "3"
2+
3+
services:
4+
5+
nginx:
6+
restart: always
7+
image: nginx:latest
8+
ports:
9+
- 80:80
10+
volumes:
11+
- ./nginx.conf:/etc/nginx/nginx.conf:ro
12+
- ./wirecloud-static:/var/www/static:ro
13+
depends_on:
14+
- wirecloud
15+
16+
17+
postgres:
18+
restart: always
19+
image: postgres:latest
20+
environment:
21+
- POSTGRES_PASSWORD=wirepass # Change this password!
22+
volumes:
23+
- ./postgres-data:/var/lib/postgresql/data
24+
25+
26+
elasticsearch:
27+
restart: always
28+
image: elasticsearch:2.4
29+
volumes:
30+
- ./elasticsearch-data:/usr/share/elasticsearch/data
31+
command: elasticsearch -Des.index.max_result_window=50000
32+
33+
34+
memcached:
35+
restart: always
36+
image: memcached:1
37+
command: memcached -m 2048m
38+
39+
40+
mysql:
41+
restart: always
42+
image: mysql/mysql-server:5.7.21
43+
environment:
44+
- MYSQL_ROOT_PASSWORD=idm
45+
- MYSQL_ROOT_HOST=%
46+
47+
48+
keyrock:
49+
restart: always
50+
image: fiware/idm:7.0.2
51+
ports:
52+
- 3000:3000
53+
environment:
54+
- DATABASE_HOST=mysql
55+
56+
57+
wirecloud:
58+
restart: always
59+
image: fiware/wirecloud:1.3
60+
depends_on:
61+
- postgres
62+
- elasticsearch
63+
- memcached
64+
environment:
65+
- DEBUG=False
66+
# - DEFAULT_THEME=wirecloud.defaulttheme
67+
- DB_HOST=postgres
68+
- DB_PASSWORD=wirepass # Change this password!
69+
- FORWARDED_ALLOW_IPS=*
70+
- ELASTICSEARCH2_URL=http://elasticsearch:9200/
71+
- MEMCACHED_LOCATION=memcached:11211
72+
- FIWARE_IDM_SERVER=${FIWARE_IDM_SERVER}
73+
- SOCIAL_AUTH_FIWARE_KEY=${SOCIAL_AUTH_FIWARE_KEY}
74+
- SOCIAL_AUTH_FIWARE_SECRET=${SOCIAL_AUTH_FIWARE_SECRET}
75+
volumes:
76+
- ./wirecloud-data:/opt/wirecloud_instance/data
77+
- ./wirecloud-static:/var/www/static

1.3/docker-compose-simple.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
version: "3"
2+
3+
services:
4+
5+
nginx:
6+
restart: always
7+
image: nginx:latest
8+
ports:
9+
- 80:80
10+
volumes:
11+
- ./nginx.conf:/etc/nginx/nginx.conf:ro
12+
- ./wirecloud-static:/var/www/static:ro
13+
depends_on:
14+
- wirecloud
15+
16+
17+
wirecloud:
18+
restart: always
19+
image: fiware/wirecloud:1.3
20+
environment:
21+
- DEBUG=False
22+
- FORWARDED_ALLOW_IPS=*
23+
volumes:
24+
- ./wirecloud-data:/opt/wirecloud_instance/data
25+
- ./wirecloud-static:/var/www/static

1.3/docker-compose-standalone.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
version: "3"
2+
3+
services:
4+
5+
wirecloud:
6+
restart: always
7+
image: fiware/wirecloud:1.3
8+
ports:
9+
- 80:8000
10+
environment:
11+
- DEBUG=True
12+
volumes:
13+
- ./wirecloud-data:/opt/wirecloud_instance/data
14+
- ./wirecloud-static:/var/www/static

1.3/docker-compose.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
version: "3"
2+
3+
services:
4+
5+
nginx:
6+
restart: always
7+
image: nginx:latest
8+
ports:
9+
- 80:80
10+
volumes:
11+
- ./nginx.conf:/etc/nginx/nginx.conf:ro
12+
- ./wirecloud-static:/var/www/static:ro
13+
depends_on:
14+
- wirecloud
15+
16+
17+
postgres:
18+
restart: always
19+
image: postgres:latest
20+
environment:
21+
- POSTGRES_PASSWORD=wirepass # Change this password!
22+
volumes:
23+
- ./postgres-data:/var/lib/postgresql/data
24+
25+
26+
elasticsearch:
27+
restart: always
28+
image: elasticsearch:2.4
29+
volumes:
30+
- ./elasticsearch-data:/usr/share/elasticsearch/data
31+
command: elasticsearch -Des.index.max_result_window=50000
32+
33+
34+
memcached:
35+
restart: always
36+
image: memcached:1
37+
command: memcached -m 2048m
38+
39+
40+
wirecloud:
41+
restart: always
42+
image: fiware/wirecloud:1.3
43+
depends_on:
44+
- postgres
45+
- elasticsearch
46+
- memcached
47+
environment:
48+
- DEBUG=False
49+
- LOGLEVEL=INFO
50+
# - DEFAULT_THEME=wirecloud.defaulttheme
51+
- DB_HOST=postgres
52+
- DB_PASSWORD=wirepass # Change this password!
53+
- FORWARDED_ALLOW_IPS=*
54+
- ELASTICSEARCH2_URL=http://elasticsearch:9200/
55+
- MEMCACHED_LOCATION=memcached:11211
56+
# Uncomment the following environment variables to enable IDM integration
57+
#- FIWARE_IDM_SERVER=${FIWARE_IDM_SERVER}
58+
#- SOCIAL_AUTH_FIWARE_KEY=${SOCIAL_AUTH_FIWARE_KEY}
59+
#- SOCIAL_AUTH_FIWARE_SECRET=${SOCIAL_AUTH_FIWARE_SECRET}
60+
volumes:
61+
- ./wirecloud-data:/opt/wirecloud_instance/data
62+
- ./wirecloud-static:/var/www/static

1.3/docker-entrypoint.sh

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
# allow the container to be started with `--user`
6+
if [ "$(id -u)" = '0' ]; then
7+
chown -R wirecloud data
8+
chown -R wirecloud /var/www/static
9+
fi
10+
11+
# Real entry point
12+
case "$1" in
13+
initdb)
14+
manage.py migrate --fake-initial
15+
manage.py populate
16+
;;
17+
createdefaultsuperuser)
18+
echo "from django.contrib.auth.models import User; User.objects.create_superuser('admin', 'admin@example.com', 'admin')" | manage.py shell > /dev/null
19+
;;
20+
createsuperuser)
21+
manage.py createsuperuser
22+
;;
23+
*)
24+
manage.py collectstatic --noinput
25+
manage.py migrate --fake-initial
26+
manage.py populate
27+
28+
# allow the container to be started with `--user`
29+
if [ "$(id -u)" = '0' ]; then
30+
exec gosu wirecloud /usr/local/bin/gunicorn wirecloud_instance.wsgi:application \
31+
--forwarded-allow-ips "${FORWARDED_ALLOW_IPS}" \
32+
--workers 2 \
33+
--bind 0.0.0.0:8000 \
34+
--log-file - \
35+
--log-level ${LOGLEVEL}
36+
else
37+
exec /usr/local/bin/gunicorn wirecloud_instance.wsgi:application \
38+
--forwarded-allow-ips "${FORWARDED_ALLOW_IPS}" \
39+
--workers 2 \
40+
--bind 0.0.0.0:8000 \
41+
--log-file - \
42+
--log-level ${LOGLEVEL}
43+
fi
44+
;;
45+
esac

1.3/manage.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/env bash
2+
cd /opt/wirecloud_instance
3+
if [ "$(id -u)" = '0' ]; then
4+
gosu wirecloud python manage.py $@
5+
else
6+
python manage.py $@
7+
fi

0 commit comments

Comments
 (0)