File tree Expand file tree Collapse file tree 7 files changed +99
-11
lines changed Expand file tree Collapse file tree 7 files changed +99
-11
lines changed Original file line number Diff line number Diff line change @@ -39,17 +39,23 @@ before_install:
3939
4040install :
4141  - pip install -e . 
42-   #  TODO: removed when openwisp-controller 0.8.0 is released
43-   - pip install -U https://github.com/openwisp/openwisp-controller/tarball/master 
44-   #  TODO: removed when openwisp-users 0.3.0 is released
45-   - pip install -U https://github.com/openwisp/openwisp-users/tarball/master 
46-   #  TODO: remove when openwisp-notifications 0.1 is released
47-   - pip install -U https://github.com/openwisp/openwisp-notifications/tarball/master 
42+   - sh install-dev.sh 
4843
4944script :
5045  - ./run-qa-checks 
5146  - SAMPLE_APP=1 coverage run --source=openwisp_monitoring runtests.py 
5247  - coverage run -a --source=openwisp_monitoring runtests.py 
5348
49+ jobs :
50+   include :
51+     - stage : Deploy 
52+       before_install : skip 
53+       install : skip 
54+       if : type = push AND branch = master 
55+       script :
56+         - echo "$DOCKER_TOKEN" | docker login --username $DOCKER_USERNAME --password-stdin 
57+         - docker build . -t openwisp/openwisp-monitoring:develop 
58+         - docker push openwisp/openwisp-monitoring:develop 
59+ 
5460after_success :
5561  coveralls 
Original file line number Diff line number Diff line change 1+ FROM  python:3.7.5-slim-buster
2+ 
3+ RUN  apt update && \
4+     apt install --yes zlib1g-dev libjpeg-dev gdal-bin libproj-dev \
5+     libgeos-dev libspatialite-dev libsqlite3-mod-spatialite \
6+     sqlite3 libsqlite3-dev openssl libssl-dev fping && \
7+     rm -rf /var/lib/apt/lists/* /root/.cache/pip/* /tmp/*
8+ 
9+ COPY  install-dev.sh requirements-test.txt requirements.txt /opt/openwisp/
10+ RUN  pip install -r /opt/openwisp/requirements.txt && \
11+     pip install -r /opt/openwisp/requirements-test.txt && \
12+     sh /opt/openwisp/install-dev.sh && \
13+     rm -rf /var/lib/apt/lists/* /root/.cache/pip/* /tmp/*
14+ 
15+ ADD  . /opt/openwisp
16+ RUN  pip install -U /opt/openwisp && \
17+     rm -rf /var/lib/apt/lists/* /root/.cache/pip/* /tmp/*
18+ WORKDIR  /opt/openwisp/tests/
19+ ENV  NAME=openwisp-monitoring \
20+     PYTHONBUFFERED=1 \
21+     INFLUXDB_HOST=influxdb \
22+     REDIS_HOST=redis
23+ CMD  ["sh" , "docker-entrypoint.sh" ]
24+ EXPOSE  8000
Original file line number Diff line number Diff line change @@ -614,6 +614,12 @@ Install your forked repo:
614614    cd  openwisp-monitoring/ 
615615    python setup.py develop 
616616
617+  Install development dependencies:
618+ 
619+ .. code-block :: shell 
620+ 
621+     ./install-dev.sh 
622+ 
617623 Install test requirements:
618624
619625.. code-block :: shell 
@@ -624,7 +630,7 @@ Start Redis and InfluxDB using docker-compose:
624630
625631.. code-block :: shell 
626632
627-     docker-compose up -d 
633+     docker-compose up -d redis influxdb  
628634
629635 Create the Django database:
630636
@@ -670,6 +676,15 @@ which are simple django apps that extend ``openwisp-monitoring`` with
670676the sole purpose of testing its extensibility, for more information regarding
671677this concept, read the following section.
672678
679+ Install and run on docker
680+ ------------------------- 
681+ 
682+ .. code-block :: shell 
683+ 
684+     #  ``--build`` parameter is useful when you want to 
685+     #  rebuild the openwisp-monitoring image with your changes. 
686+     docker-compose up --build 
687+ 
673688 Extending openwisp-monitoring
674689----------------------------- 
675690
Original file line number Diff line number Diff line change 11version : " 3" 
22
33services :
4+   monitoring :
5+     image : openwisp/openwisp-monitoring:develop 
6+     build :
7+       context : . 
8+       dockerfile : Dockerfile 
9+     ports :
10+       - " 8000:8000" 
11+     depends_on :
12+       - influxdb 
13+       - redis 
14+ 
415  influxdb :
516    image : influxdb:1.8-alpine 
617    volumes :
@@ -19,4 +30,4 @@ services:
1930    entrypoint : redis-server --appendonly yes 
2031
2132volumes :
22-   influxdb-data :
33+   influxdb-data :  {} 
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ 
3+ #  TODO: removed when openwisp-controller 0.8.0 is released
4+ pip install -U https://github.com/openwisp/openwisp-controller/tarball/master
5+ #  TODO: removed when openwisp-users 0.3.0 is released
6+ pip install -U https://github.com/openwisp/openwisp-users/tarball/master
7+ #  TODO: remove when openwisp-notifications 0.1 is released
8+ pip install -U https://github.com/openwisp/openwisp-notifications/tarball/master
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ 
3+ create_superuser () {
4+     local  username=" $1 " 
5+     local  email=" $2 " 
6+     local  password=" $3 " 
7+     cat << EOF  | python manage.py shell
8+ from django.contrib.auth import get_user_model 
9+ 
10+ User = get_user_model() 
11+ 
12+ if not User.objects.filter(username="$username ").exists(): 
13+     User.objects.create_superuser("$username ", "$email ", "$password ") 
14+ else: 
15+     print('User "{}" exists already, not created'.format("$username ")) 
16+ EOF 
17+ }
18+ 
19+ python manage.py migrate --no-input
20+ create_superuser admin 
[email protected]  admin
21+ celery -A openwisp2 worker -l info & 
22+ celery -A openwisp2 beat -l info & 
23+ python manage.py runserver 0.0.0.0:8000
Original file line number Diff line number Diff line change 2121    'USER' : 'openwisp' ,
2222    'PASSWORD' : 'openwisp' ,
2323    'NAME' : 'openwisp2' ,
24-     'HOST' : ' localhost' ,
24+     'HOST' : os . getenv ( 'INFLUXDB_HOST' ,  ' localhost') ,
2525    'PORT' : '8086' ,
2626}
2727
144144
145145OPENWISP_MONITORING_MANAGEMENT_IP_ONLY  =  False 
146146
147+ redis_host  =  os .getenv ('REDIS_HOST' , 'localhost' )
147148CACHES  =  {
148149    'default' : {
149150        'BACKEND' : 'django_redis.cache.RedisCache' ,
150-         'LOCATION' : 'redis://localhost /0' ,
151+         'LOCATION' : f 'redis://{ redis_host }  /0' ,
151152        'OPTIONS' : {'CLIENT_CLASS' : 'django_redis.client.DefaultClient' ,},
152153    }
153154}
156157SESSION_CACHE_ALIAS  =  'default' 
157158
158159if  not  TESTING :
159-     CELERY_BROKER_URL  =  'redis://localhost /1' 
160+     CELERY_BROKER_URL  =  f 'redis://{ redis_host }  /1'
160161else :
161162    CELERY_TASK_ALWAYS_EAGER  =  True 
162163    CELERY_TASK_EAGER_PROPAGATES  =  True 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments