Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated referenced docker images #52

Open
wants to merge 9 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 60 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,29 @@
# sync-endpoint-default-setup

## What is sync-endpoint-default-setup
sync-endpoint-default-setup is a project that provides a default setup and configuration for the ODK-X Sync Endpoint. ODK-X is a suite of tools and services for data collection, management, and synchronization, often used for field data collection in research, humanitarian work, and other applications.

## Table of Contents

1. [Prerequisites](#prerequisites)
2. [Build](#build)
- 2.1 [Using the init-odkx-sync-endpoint.py script](#using-the-init-odkx-sync-endpointpy-script)
- 2.2 [Manual Build Instructions](#manual-build-instructions)
3. [Run](#run)
4. [Clean up](#clean-up)
5. [Configuration](#configuration)
6. [LDAP](#ldap)
- 6.1 [Creating Users (with phpLDAPadmin)](#creating-users-with-phpldapadmin)
- 6.2 [Creating Groups (with phpLDAPadmin)](#creating-groups-with-phpldapadmin)
- 6.3 [Assigning Users to Groups (with phpLDAPadmin)](#assigning-users-to-groups-with-phpldapadmin)
- 6.4 [Using ldap-utils](#using-ldap-utils)
7. [Advanced Configuration](#advanced-configuration)
- 7.1 [Using a Different Database or LDAP Directory](#using-a-different-database-or-ldap-directory)
- 7.2 [Managing Identity through DHIS2](#managing-identity-through-dhis2)
8. [Warnings](#warnings)
9. [Notes](#notes)
10. [Ubuntu 18.04 Example Installation](#ubuntu-1804-example-installation)

## Prerequisites
- Git
- Docker (with swarm mode enabled)
Expand Down Expand Up @@ -82,7 +108,7 @@ The `ldap-service` container has `ldap-utils` installed. If you'd prefer, you ma

#### Using a Different Database or LDAP directory

See [here](http://opendatakit-dev.cs.washington.edu/2_0_tools/release/current_release/cloud_endpoints).
See [here](https://docs.odk-x.org/sync-endpoint/#using-a-different-ldap-ui).

#### Managing Identity through DHIS2

Expand All @@ -109,19 +135,41 @@ The phpLDAPadmin container is from [osixia/phpldapadmin](https://github.com/osix

Refer to their respecitve documentations for usage information.

## Ubuntu 18.04 Example installation
## To get setup on a clean installation of Ubuntu 18.04 run the following commands;
## Ubuntu 22.04 Example installation
## To get setup on a clean installation of Ubuntu 22.04:

First add Docker's apt repository and install docker - see [Docker's documentation](https://docs.docker.com/engine/install/ubuntu/) and enable swarm mode
```bash
# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc

# Add the repository to Apt sources:
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update

sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

docker swarm init
```
Then install maven and certbot
```bash
sudo apt-get install maven certbot
```
user@localhost:~/# apt update
user@localhost:~/# apt install docker.io
user@localhost:~/# docker swarm init
user@localhost:~/# apt install maven
user@localhost:~/# apt install certbot
user@localhost:~/# git clone https://github.com/odk-x/sync-endpoint-default-setup.git odkx
user@localhost:~/# cd odkx
user@localhost:~/odkx# python3 init-odkx-sync-endpoint.py
Finally clone the default setup repo and run the initialization script with python

```bash
git clone https://github.com/odk-x/sync-endpoint-default-setup.git odkx
cd odkx
python3 init-odkx-sync-endpoint.py
```
... then follow the on-screen instructions.
... continue to follow the on-screen instructions.

When everything has been built and started, you can open a browser and go to https://<your_domain>:40000 to access the LDAP admin interface.
Log in with username = **cn=admin,dc=example,dc=org** and the password you defined during the intialization script. Then you can [create the ODK-X Sync Endpoint users according to the documentation](https://docs.odk-x.org/sync-endpoint/#creating-users).
6 changes: 3 additions & 3 deletions db-bootstrap/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ case ${DB_VAR} in
DB_PORT=5432
eval ${WAIT_CMD}
docker exec ${DB_CONTAINER_ID} psql \
-c 'CREATE USER odk WITH UNENCRYPTED PASSWORD '\''odk'\'';' \
-c 'CREATE USER odk WITH PASSWORD '\''odk'\'';' \
-c 'CREATE SCHEMA odk_sync AUTHORIZATION odk;' \
-c 'GRANT ALL PRIVILEGES ON SCHEMA odk_sync TO odk;' \
-U ${POSTGRES_USER} -d ${POSTGRES_DB}
Expand Down Expand Up @@ -96,7 +96,7 @@ echo "Done"
echo "Checking Sync endpoint"

# Wait 5 seconds for a 200 from Sync
timeout -t 5 sh -c 'while ! echo -ne "GET / HTTP/1.1\nHost: sync\n\n" | nc -w 1 sync 8080 | grep -q "HTTP/1.1 200"; do echo '\''waiting for Sync'\''; sleep 1; done'
timeout 5 sh -c 'while ! echo -ne "GET / HTTP/1.1\nHost: sync\n\n" | nc -w 1 sync 8080 | grep -q "HTTP/1.1 200"; do echo '\''waiting for Sync'\''; sleep 1; done'

if [ $? -eq 143 ]; then
echo "Timeout"
Expand All @@ -107,4 +107,4 @@ fi;

echo "Exit"

exit 0
exit 0
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ services:
env_file:
- ldap.env
db:
image: postgres:9.6
image: postgres:12.17
deploy:
replicas: 1
networks:
Expand Down Expand Up @@ -75,7 +75,7 @@ services:
- org.opendatakit.sync-web-ui.application.properties

nginx:
image: nginx:1.21.3
image: nginx:1.25.4
networks:
- sync-network
ports:
Expand Down
2 changes: 1 addition & 1 deletion init-odkx-sync-endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def run_docker_builds():


def run_sync_endpoint_build():
os.system("git clone -b master --single-branch --depth=1 https://github.com/odk-x/sync-endpoint ; \
os.system("git clone -b circleci-taketwo --single-branch --depth=1 https://github.com/odk-x/sync-endpoint ; \
cd sync-endpoint ; \
mvn -pl org.opendatakit:sync-endpoint-war,org.opendatakit:sync-endpoint-docker-swarm,org.opendatakit:sync-endpoint-common-dependencies clean install -DskipTests")

Expand Down