Commit 507fddfd authored by Aleksander Piotrowski's avatar Aleksander Piotrowski

Merge branch 'develop' into 'staging'

Develop

See merge request geoplan/geoankieta!2292
parents 2187eef1 93a445a3
......@@ -24,7 +24,7 @@ indent_size = 2
indent_size = 2
insert_final_newline = ignore
[**/admin/js/vendor/**]
[**/panel_forms/js/vendor/**]
indent_style = ignore
indent_size = ignore
......
......@@ -18,4 +18,11 @@ plugins.sh
/test/*
kubernetes/config.ready.sh
\ No newline at end of file
kubernetes/config.ready.sh
#Python virtual environment
/web/lib/*
/web/bin/*
/web/include/*
/web/local/*
/web/man/*
\ No newline at end of file
This diff is collapsed.
## Adresses
https://api.k8s.thebitbybit.com | https://api.staging.thebitbybit.com
https://discuss.k8s.thebitbybit.com | https://panel.discuss.staging.thebitbybit.com
https://forms.k8s.thebitbybit.com | https://panel.forms.staging.thebitbybit.com
https://geoforms.k8s.thebitbybit.com | https://geoforms.staging.thebitbybit.com
## Praca w trybie developerskim
Aby `docker-compose` nam działał trzeba się zalogować do rejestru dockerowego. Wystarczy się zalogować raz. Potem już będzie pamiętało że jesteśmy zalogowani.
```
docker login registry.recoded.co
```
Dodatkowo **trzeba** stworzyć network geoankieta
```
docker network create geoankieta
```
___
## Aby stworzyć główny obraz (dotyczy głównie gitlabCi)
```
docker login registry.recoded.co
```
Podajemy login i hasło do gitlaba
następnie budujemy obraz (tag jest bardzo ważny, nie można go zmieniać)
```
docker build -t registry.recoded.co/geoplan/geoankieta/geopine:frontend -f geopine/Frontend.dockerfile .
docker build -t registry.recoded.co/geoplan/geoankieta/geopine:backend -f geopine/Backend.dockerfile .
```
po zbudowaniu możemy wepchnąć go do rejestru (**jeżeli nie wiesz po co to robić, to nie wykonuj teog kroku**)
```
docker push registry.recoded.co/geoplan/geoankieta/geopine:frontend
docker push registry.recoded.co/geoplan/geoankieta/geopine:backend
```
Na registry jest najnowszy obraz z najnowszymi zależnościami.
Gdy nie mamy tego obrazu a go potrzebujemy (np. debug gitlabCi) można go **pobrać**
tak samo jak z zwykłego registry po uprzednim zalogowaniu się.
\ No newline at end of file
# Lopi/Geoankieta / Geodyskusja
[![LOPI](https://lopi.io/wp-content/uploads/2019/02/Zaso%CC%81b-2@3x.png)](https://git.recoded.co/)
Lopi is a unique connection of internet surveys, discussion forums, and digital maps. It brings new possibilities for decision makers, by providing them with a tool for collecting data from citizens and automatically in a real-time analyze them. Thanks to Lopi almost everyone has a possibility to use, formerly available only for professional companies GIS software and statistical analyses.
________________
## Tech
Lopi uses a number of open source projects to work properly:
* Python - 3.7.2
* Django - 1.11.2
* Docker - 18.09.0
* Docker-Compose - 1.23.+
* React - 15.6.1
* Redux - 4.0.+
_______________
## Installation Docker and Docker-Compose
Lopi requires installation of Docker and Docker-Compose. Installation steps for individual operating systems are shown below.
#### Installation for MAC
To use Docker and Docker-Compose You only need to install [Docker Desktop for Mac](https://docs.docker.com/docker-for-mac/install/) (Already include Compose along with other Docker apps, so Mac users do not need to install Compose separately).
#### Installation for Linux
1. Install Docker
This command update the apt package index and install the latest version of Docker Engine:
```sh
$ sudo apt-get update
$ sudo apt-get install docker-ce docker-ce-cli containerd.io
```
[More info about install Docker](https://docs.docker.com/install/linux/docker-ce/ubuntu/)
2. Install Docker-Copmose
The following commands to download the current stable release of Docker Compose:
```sh
sudo curl -L "https://github.com/docker/compose/releases/download/1.24.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
```
Apply executable permissions to the binary by:
```sh
sudo chmod +x /usr/local/bin/docker-compose
```
You can check if the installation was successful:
```sh
$ docker-compose --version
```
[More info about install Docker-Compose](https://docs.docker.com/compose/install/)
#### Instalation for Windows
Docker will run ONLY on Windows 10 PRO. If You use Windows 10 Home You need upgrade them to Windows 10 PRO.
In Windows case will be better to install virtual machine(with any Linux distribution e.g [Ubuntu](https://ubuntu.com/download/desktop)) for example [VirtualBox](https://www.virtualbox.org/). After that, fallow the steps as for Linux case.
Make sure you have the virtualization option enabled on your processor. You could check this in BIOS/UEFI or in task manager(in the performance tab).
_____________
## Run Lopi - Developer mode
1. Clone the repository on your device by HTTPS:
```sh
$ git clone https://git.recoded.co/geoplan/geoankieta
```
Or You may use SSH:
```sh
$ git clone git@git.recoded.co:geoplan/geoankieta.git
```
2. To run Docker-Compose you have to log in to the register(provide login details from gitlab):
```sh
docker login registry.recoded.co
docker network create geoankieta
```
3. Build image and run app:
Move to the 'geoankieta' folder:
```sh
cd geoankieta
```
* This step is only for first run app:
```sh
docker-compose up --build
```
* Next time You can run app with:
```sh
docker-compose up
```
_________________________
## Ports - Developer mode
| PORT | SERVICE | DESCRIPTION |
| ------ | ------ | ------ |
| :8000 | API | Beckend for everything |
| :3000 | geoforms | Geoforms app |
| :3001 | panel_forms | Geoforms management |
| :3002 | panel_discuss | Discuss management |
_________________
## Useful commands
* To enter the container
```sh
docker ps
```
Choose the ID of the container you are interested in and input this command:
```sh
docker exec -it CONTAINER_ID bash
```
Or You could enter the container by their name:
```sh
docker exec -it CONTAINER_NAME bash
```
- CONTAINER_NAME for example: geoankieta_web_1
__________________
* Drop database
```sh
docker exec -it geoankieta_web_1 bash
./manage.py reset_db -c --noinput
./manage.py migrate
```
or
```sh
docker stop geoankieta_web_1
docker exec -it geoankieta_db_1 bash
dropdb -U postgres geoankieta_develop
createdb -U postgres geoankieta_develop
```
____________
* Migrations
```sh
docker exec geoankieta_web_1 python manage.py makemigrations
docker exec geoankieta_web_1 python manage.py migrate
```
migration with merge
```sh
docker exec geoankieta_web_1 python manage.py makemigrations --merge
docker exec geoankieta_web_1 python manage.py migrate
```
____________
* Check these commands for more efficient work
```sh
docker exec -it geoankieta_web_1 ./manage.py
```
* Adding translations to the branch
```sh
docker exec -it geoankieta_web_1 bash
./manage.py compilemessages
```
_____________
### Collaborator
* Dariusz Walczak @darek
* Marek Młodkowski @marek
* Bartłomiej Żmudziński @bartek
* Jacek Graczyk @jacek
* Aleksander Piotrowski @aleksander
* Mateusz Głowacki @matg
* Aleksy Wróblewski @aleksy
* Daniel Wilczewski @danielw
* Łukasz Nojman @luknoj
* Milena Ciesielska @milena
* Zuzanna Wojtyniak @zuzanna
* Bartosz Adamczyk @bartosza
* Cezary Brudka @cezary.brudka
* Michał Dyczkowski @michalID
* Michał Gołębiewski @michalgolebiewski
* Anna Czaplicka @annaC
* Mateusz Napieralski @mateuszn
* Bartłomiej Winiarski @bartlomiejW
* Patryk Jagielski @patrykj
* Patryk Śliwiński @patryks
* Kiryl Averkiyeu @kirylA
### Retired collaborators
* Adam Domagalski @adam.domagalski
* Daniel Jasik @daniel
* Gerard Smętek @gerard
* Aleksander Kruk @akruk
* Michał Czepkiewicz @michal.czepkiewicz
* Paweł Dopierała @paweld
* Piotr Ratajczak @piotr
* Szymon Nowacki @szymon
________________
### License
App is under [GNU GENERAL PUBLIC LICENSE](https://choosealicense.com/licenses/gpl-3.0/)
last 2 version
> 0.2%
not dead
\ No newline at end of file
/* global it */
import App from './App';
import React from 'react';
import ReactDOM from 'react-dom';
it('renders without crashing', () => {
const div = document.createElement('div');
ReactDOM.render(<App />, div);
});
......@@ -30,14 +30,14 @@ services:
depends_on:
- db
admin:
build: ./admin
image: registry.recoded.co/geoplan/geoankieta:admin-latest
env_file: ./admin/.env
panel_forms:
build: ./panel_forms
image: registry.recoded.co/geoplan/geoankieta:panel_forms-latest
env_file: ./panel_forms/.env
ports:
- 3001:3001
volumes:
- ./admin/src:/srv/app
- ./panel_forms/src:/srv/app
depends_on:
- web
......
FROM nginx:1.17.3-alpine
WORKDIR /app
COPY ./etc/nginx.conf /etc/nginx/nginx.conf
COPY ./etc/webapp.conf /etc/nginx/conf.d/default.conf
COPY ./plug/ /app
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
\ No newline at end of file
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 4096;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
server_tokens off;
sendfile on;
keepalive_timeout 65;
# SSL Settings
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ciphers ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GC$;
# Optimize session cache
ssl_session_cache shared:SSL:50m;
ssl_session_timeout 1d;
ssl_session_tickets on;
# OCSP Stapling
ssl_stapling on;
ssl_stapling_verify on;
resolver 8.8.8.8 8.8.4.4 208.67.222.222 208.67.220.220 valid=60s;
resolver_timeout 2s;
# Limits
limit_req_zone $binary_remote_addr zone=reqlimit:10m rate=5r/s;
# compression
gzip on;
gzip_types application/json;
gzip_comp_level 6;
gzip_buffers 32 16k;
gzip_http_version 1.1;
gzip_min_length 250;
# brotli on;
# brotli_comp_level 4;
# brotli_buffers 32 8k;
# brotli_min_length 100;
# brotli_static on;
# brotli_types image/jpeg image/bmp image/svg+xml text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript image/x-icon;
include /etc/nginx/conf.d/*.conf;
}
server {
listen 80;
server_name ~.;
root /app;
limit_req zone=reqlimit burst=20;
index index.html index.htm;
location / {
index /index.html;
}
}
html,
body {
font-family: "Lato", sans-serif;
height: 100%;
}
body {
margin: 0;
padding: 0;
}
.container {
position: relative;
top: 50%;
transform: translateY(-50%);
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.container > p {
font-size: 18px;
text-align: center;
width: 30%;
color: #21216c;
margin: 5px 0 15px 0;
overflow-wrap: break-word;
}
.container > a.button {
font-size: 14px;
text-transform: uppercase;
text-decoration: none;
text-align: center;
width: 15%;
outline: none;
color: #21216c;
background: #7ad8e5;
box-shadow: 0px 2px 5px 0px rgba(102, 102, 102, 0.8);
border-radius: 20px;
border: 10px solid #7ad8e5;
padding: 0 0 3px 0;
overflow-wrap: normal;
}
.container > a.button:hover {
background: #00b8ff;
border: 10px solid #00b8ff;
}
@media screen and (min-width: 1024px) {
.container .logo {
max-height: 100px;
}
}
@media screen and (max-width: 1024px) {
.container .logo {
max-height: 70px;
}
.container > p {
font-size: 16px;
width: 60%;
}
.container .image {
height: 250px;
}
.container > a.button {
width: 30%;
}
}
@media screen and (max-width: 768px) {
.container .logo {
max-height: 80px;
}
.container .image {
height: 150px;
}
.container > p {
font-size: 14px;
width: 80%;
}
.container > a.button {
font-size: 12px;
width: 30%;
}
.container > a.button:hover {
background: #00b8ff;
border: 10px solid #00b8ff;
}
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="index.css" />
<link href="https://fonts.googleapis.com/css?family=Lato&display=swap" rel="stylesheet" />
<title>Lopi</title>