pgx
PGX — Lightweight Postgres for AI agents. Written in Rust. Thousands of isolated databases in one runtime. 🐘
翻译准备中
FormShare - The data & analytics platform for field & frontline work
翻译准备中
取自仓库 README
正在加载完整 README。
查看完整 README ↗Centralize data – Decentralize knowledgeTM
FormShare is an advanced data management platform for Open Data Kit (ODK). FormShare is inspired by the excellent FormHub platform developed by the Sustainable Engineering Lab at Columbia University. After we forked OnaData (a fork of FormHub) back in 2016 it was clear that the code needed a lot to bring it to a complete data management platform.
FormShare has been written from scratch (reimplementing ideas, principles, and logic) using Python 3, FastAPI, MySQL, Elasticsearch, and PyUtilib to deliver a complete and extensible data management solution for ODK Data collection.
FormShare Community Server is available at https://formshare.org for students and very small organizations. FormShare SaaS is available at https://www.qlands.com/plans
For more information visit at www.qlands.com
FormShare can produce dates and times in the following time zones:
Parse submissions into database tables. FormShare will create a MySQL data repository to store your data.
Filtering submissions by submission metadata (e.g., date and time received on server).
Data cleaning API integration with R, STATA, or SPSS.
Data dictionary with personal information protection (PII filtering).
Though FormShare with the default settings can handle a load that would fit most organizations, it can be configured to handle any load. FormShare has been tested, using JMeter, under extreme traffic (100 parallel submissions loading 50,000 submissions).
The current stable release is 3.1.0 and it is available here
The database signature for stable 3.1.0 is 89adc46b7aaa
The Docker image for stable 3.1.0 is 20261018
Never upgrade FormShare from one Docker image to another without checking the "Upgrading information" section below.
Install FormShare using the Docker Compose files available in the docker_compose directory.
The below is a common recipe for running FormShare using docker:
# From a fresh installation of Ubuntu 22.04 from https://ubuntu.com/download/server
# Update the repositories and packages
sudo add-apt-repository multiverse
sudo apt-get update
sudo apt-get -y upgrade
# Install docker-compose
sudo apt-get install -y docker-compose
# Get the Docker Compose files
cd /opt
sudo mkdir formshare_community
cd formshare_community
sudo wget https://raw.githubusercontent.com/qlands/FormShare/refs/heads/master-3.0/docker_compose/servers.yml
sudo wget https://raw.githubusercontent.com/qlands/FormShare/refs/heads/master-3.0/docker_compose/formshare.yml
sudo wget https://raw.githubusercontent.com/qlands/FormShare/refs/heads/master-3.0/docker_compose/env.example
# Make the directory structure for FormShare
sudo mkdir -p /opt/formshare_community/celery
sudo mkdir -p /opt/formshare_community/log
sudo mkdir -p /opt/formshare_community/repository
sudo mkdir -p /opt/formshare_community/config
sudo mkdir -p /opt/formshare_community/mysql
sudo mkdir -p /opt/formshare_community/plugins
sudo mkdir -p /opt/formshare_community/elasticsearch/certs
sudo mkdir -p /opt/formshare_community/elasticsearch/esdata
sudo mkdir -p /opt/formshare_community/elasticsearch/esdata2
sudo chmod -R g+w /opt/formshare_community
# Install docker-compose and give it enough memory
sudo sysctl -w vm.max_map_count=262144
echo 'vm.max_map_count=262144' | sudo tee -a /etc/sysctl.d/60-vm-max_map_count.conf
# Create a .env file using the example
sudo mv env.example .env
# Edit .env file to change:
# -The mysql security credentials:
MYSQL_USER_NAME=root
MYSQL_ROOT_PASSWORD=change_me_mysql_root
MYSQL_USER_PASSWORD=change_me_mysql_root
#- The Elasticsearch security credentials:
ELASTIC_PASSWORD=change_me_elastic
#-The admin credentials:
FORMSHARE_ADMIN_USER=admin
[email protected]
FORMSHARE_ADMIN_PASSWORD=change_me_admin
#Start MySQL and Elasticsearch
sudo docker-compose --env-file .env -f servers.yml up -d
#Start FormShare
sudo docker-compose --env-file .env -f formshare.yml up -d
#Docker will pull the necessary images and run FormShare. After all images are pulled and
#all services run, you will be able to access FormShare at http://localhost:5900/.
# RDS Notes:
# In AWS if you use MySQL >= 8 in a RDS service you need to add the following permissions to your RDS root user:
# GRANT SESSION_VARIABLES_ADMIN ON *.* TO 'my_RDS_root_user'@'%';
# GRANT SYSTEM_VARIABLES_ADMIN ON *.* TO 'my_RDS_root_user'@'%';
Run FormShare behind HTTPS in production. Field encryption (questions an
XLSForm marks fs_encrypted: yes) cannot work without it, because browsers
offer WebAuthn and WebCrypto only on secure origins. TLS can end in front of
FormShare, at Apache, nginx or a load balancer. When it does, have the proxy
send X-Forwarded-Proto: https so that FormShare marks its login cookies
Secure.
The auth.secure_cookies setting decides that flag:
auto (the default): the login cookies are Secure when the request came
over HTTPS;true: always Secure, the session cookie included;false: never.All plug-ins must be deployed in the directory /opt/formshare/plugins which is a volume in all the provided docker compose files.
# Grab the container ID running FormShare
sudo docker stats
# Get into the container
sudo docker exec -it formshare_app /bin/bash
# Activate the environment
source /opt/formshare_env/bin/activate
# Go to the plugins directory
cd /opt/formshare_plugins
# For each plugin run develop
pip install -e .
# For each plugin compile the language catalogs
python setup.py compile_catalog
# Stop FormShare
cd /opt/formshare_uvicorn
pkill -F ./formshare.pid
# Edit the file /opt/formshare/config/development.ini and enable the plug-ins
sudo nano /opt/formshare/config/development.ini
# Start FormShare
cd /opt/formshare_unicorn
./run_server.sh
# Exit the docker container
Important Note: You may need to repeat these steps if the FormShare container gets updated or if you update FormShare. Use the information in "Upgrading information" if this is the case.
Versions of FormShare > 2.44.0 use MySQL 8.4.7 that requires TLS and removed "mysql_native_password". It also upgraded Redis Sessions to 1.8.1. Settings must be modified manually:
Versions of FormShare > 2.44.0 use Elasticsearch 9.2.1. There is no automatic migration from Elasticsearch 7.14.2 to 9.2.1. Indexes must be migrated manually:
Docker images >= 20211019 (from stable 2.10.0) use and check for Elasticsearch version 7.14.X. To upgrade FormShare beyond 20211019 you need to update the docker-compose.yml to use the Docker image 7.14.X of Elasticsearch for all the nodes of Elasticsearch that you have. If you are upgrading from images < 20210801 then you need to perform perform migration 1 first (see below). You also need to update the configuration of your nodes:
Old configuration (images < 20211109):
fselasticsearch_20210805:
image: docker.elastic.co/elasticsearch/elasticsearch:6.8.14
container_name: fs_elasticsearch_20210805
environment:
- cluster.name=docker-cluster
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
- network.host=172.28.1.1
- "discovery.zen.minimum_master_nodes=2"
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- /opt/formshare/elasticsearch/esdata:/usr/share/elasticsearch/data
networks:
fsnet:
ipv4_address: 172.28.1.1
fselasticsearch2_20210805:
image: docker.elastic.co/elasticsearch/elasticsearch:6.8.14
container_name: fs_elasticsearch2_20210805
environment:
- cluster.name=docker-cluster
- bootstrap.memory_lock=true
- network.host=172.28.1.2
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
- "discovery.zen.ping.unicast.hosts=172.28.1.1"
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- /opt/formshare/elasticsearch/esdata2:/usr/share/elasticsearch/data
networks:
fsnet:
ipv4_address: 172.28.1.2
New configuration (images >= 20211009):
fses20211019n01:
image: docker.elastic.co/elasticsearch/elasticsearch:7.14.2
container_name: fses20211019n01
environment:
- network.host=172.28.1.1
- node.name=fses20211019n01
- cluster.name=fs-es-cluster
- discovery.seed_hosts=fses20211019n02
- cluster.initial_master_nodes=fses20211019n01,fses20211019n02
- bootstrap.memory_lock=true
- xpack.security.enabled=false
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- /opt/formshare/elasticsearch/esdata:/usr/share/elasticsearch/data
networks:
fsnet:
ipv4_address: 172.28.1.1
fses20211019n02:
image: docker.elastic.co/elasticsearch/elasticsearch:7.14.2
container_name: fses20211019n02
environment:
- network.host=172.28.1.2
- node.name=fses20211019n02
- cluster.name=fs-es-cluster
- discovery.seed_hosts=fses20211019n01
- cluster.initial_master_nodes=fses20211019n01,fses20211019n02
- bootstrap.memory_lock=true
- xpack.security.enabled=false
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- /opt/formshare/elasticsearch/esdata2:/usr/share/elasticsearch/data
networks:
fsnet:
ipv4_address: 172.28.1.2
Note that the container names have no special characters and the way Nodes are discovered change in ES 7.14.X
Docker images >= 20210411 (from stable 2.8.0) use and check for Elasticsearch version 6.8.14. To upgrade FormShare beyond 20210411 you need to update the docker-compose.yml to use the Docker image 6.8.14 of Elasticsearch for all the nodes of Elasticsearch that you have.
image: docker.elastic.co/Elasticsearch/Elasticsearch:6.8.14
# Make a backup of your installation. See the section "Backup FormShare"
# Edit the file /opt/formshare/config/development.ini and disable all plug-ins
sudo nano /opt/formshare/config/development.ini
# Edit the .env file
# Change the FORMSHARE_IMAGE to the lastest image of FormShare Community
# Start the Docker container again
# If you have plug-ins then you need to build them and enable them again. See the section "Install plug-ins while using Docker"
FormShare uses MySQL, Elasticsearch, and a file repository. All of them are synchronized, thus the following list of things may make your FormShare installation inaccessible, inconsistent and/or broken:
FormShare uses MySQL, Elasticsearch, and a file repository. All of them are synchronized. To backup FormShare do:
The best way to contribute to FormShare is by testing it and posting issues. If you can fix things do the following:
We also appreciate and need translation files. See the Localization section.
FormShare uses PyUtilib Component Architecture to allow customization and extension. The best way to do it is by using the FormShare Plugin CookieCutter and explore the different Interfaces.
What can you do through extension plug-ins? Some ideas:
You basically can extend FormShare to fit your needs.
Some examples of plug-ins are:
FormShare comes out of the box in English, Spanish, French, and Portuguese. It uses Babel for translation and you can help us by creating new translations or by correcting an existing one.
To generate a new translation:
$ cd formshare
$ python setup.py init_catalog -l [new_language_ISO_639-1_code]
$ python setup.py extract_messages
$ python setup.py update_catalog
The translation files (.po) are available at formshare/locale/[language-code]/LC_MESSAGES. You can edit a .po file with tools like PoEdit, Lokalize, GTranslator, or a simple text editor. Once the translation is done you can send us the updated or new .po file as an issue and we will add it to FormShare.
FormShare is released under the terms of QLands Open Source License.
The plug-in mechanism since it is based on PyUtilib is covered by a BSD type of license.