1
0

Initial commit

This commit is contained in:
David Boreham 2022-08-03 20:37:16 -06:00
parent 107fdafe57
commit ac81d642aa
4 changed files with 107 additions and 0 deletions

36
docker-compose-test.yaml Normal file
View File

@ -0,0 +1,36 @@
version: '3'
services:
# Postgresql DB
db:
image: timescale/timescaledb:latest-pg14
command: -c work_mem=256MB
restart: unless-stopped
environment:
POSTGRES_PASSWORD: db
POSTGRES_USER: db
POSTGRES_DB: db
POSTGRES_HOST_AUTH_METHOD: trust
ports:
# Postgresql
- "5432"
# Elastic
es:
restart: unless-stopped
image: docker.elastic.co/elasticsearch/elasticsearch:7.10.0
environment:
- xpack.security.enabled=false
- discovery.type=single-node
ulimits:
memlock:
soft: -1
hard: -1
nofile:
soft: 65536
hard: 65536
cap_add:
- IPC_LOCK
ports:
- 9200

8
repository-list.txt Normal file
View File

@ -0,0 +1,8 @@
vulcanize/ops
vulcanize/ipld-eth-db
vulcanize/go-ethereum
vulcanize/ipld-eth-server
vulcanize/eth-statediff-fill-service
vulcanize/ipld-eth-db-validator
vulcanize/ipld-eth-beacon-indexer
vulcanize/ipld-eth-beacon-db

55
setup-repositories.py Normal file
View File

@ -0,0 +1,55 @@
# env vars:
# DEV_ROOT defaults to ~/vulcanize
import os
import argparse
from pydoc import ispackage
from decouple import config
import git
parser = argparse.ArgumentParser(
description="git clone the set of repositories required to build the complete system from source",
epilog="Config provided either in .env or settings.ini or env vars: DEV_ROOT (defaults to ~/vulcanize)"
)
parser.add_argument("--verbose", action="store_true", help="increase output verbosity")
parser.add_argument("--quiet", action="store_true", help="don\'t print informational output")
parser.add_argument("--check-only", action="store_true", help="looks at what\'s already there and checks if it looks good")
parser.add_argument("--dry-run", action="store_true", help="don\'t do anything, just print the commands that would be executed")
args = parser.parse_args()
print(args)
verbose = args.verbose
quiet = args.quiet
dev_root_path = config("DEV_ROOT", default="~/vulcanize")
if not args.quiet:
print(f'Dev Root is: {dev_root_path}')
with open("repository-list.txt") as repositoryListFile:
repos = repositoryListFile.read().splitlines()
if verbose:
print (f'Repos: {repos}')
# Ok, now we can go ahead and look to see which if any of the repos are already cloned
def processRepo(repo):
full_github_repo_path = f'git@github.com:{repo}'
repoName = repo.split("/")[-1]
fullFilesystemRepoPath = os.path.join(dev_root_path, repoName)
isPresent = os.path.isdir(fullFilesystemRepoPath)
print(f'Checking: {fullFilesystemRepoPath}, exists: {isPresent}')
if not isPresent:
# Clone
if not quiet:
print(f'Running git clone for {full_github_repo_path} into {fullFilesystemRepoPath}')
if not args.check_only:
git.Repo.clone_from(full_github_repo_path, fullFilesystemRepoPath)
else:
print("(git clone skipped)")
for repo in repos:
processRepo(repo)

View File

@ -0,0 +1,8 @@
from testcontainers.compose import DockerCompose
from testcontainers.core.docker_client import DockerClient
from testcontainers.core.exceptions import NoSuchPortExposed
from testcontainers.core.waiting_utils import wait_for_logs
with DockerCompose(filepath=".", compose_file_name="docker-compose-test.yaml") as compose:
port = compose.get_service_port("db", 5432)
print(port)