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

Feature/dcore docker for testing #30

Merged
merged 11 commits into from
Jun 24, 2019
Merged
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
5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ before_install:
- chmod +x docker-compose
- sudo mv docker-compose /usr/local/bin
# start our container
- cp Dockerfile.travis Dockerfile
- docker-compose up -d
# install dependencies
- docker-compose exec php composer install --dev --prefer-dist --optimize-autoloader
Expand All @@ -41,3 +42,7 @@ deploy:
on:
tags: true
branch: release

after_script:
- docker-compose down

3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,10 @@ RUN apk add --update --no-cache \
libmcrypt-dev \
doxygen \
git
RUN pecl install xdebug
RUN docker-php-ext-configure mcrypt --with-mcrypt
RUN docker-php-ext-configure bcmath --enable-bcmath
RUN docker-php-ext-install bcmath gmp mcrypt
RUN docker-php-ext-enable mcrypt xdebug
RUN docker-php-ext-enable mcrypt

RUN echo "memory_limit = -1" > /usr/local/etc/php/conf.d/memory.ini

Expand Down
29 changes: 29 additions & 0 deletions Dockerfile.travis
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
FROM php:7.1-alpine

COPY --from=composer:latest /usr/bin/composer /usr/bin/composer

RUN apk add --update --no-cache \
php7-pear \
php7-dev \
openssh \
$PHPIZE_DEPS \
php7-bcmath \
php7-openssl \
gmp \
gmp-dev \
libmcrypt \
libmcrypt-dev \
doxygen \
git
RUN pecl install xdebug
RUN docker-php-ext-configure mcrypt --with-mcrypt
RUN docker-php-ext-configure bcmath --enable-bcmath
RUN docker-php-ext-install bcmath gmp mcrypt
RUN docker-php-ext-enable mcrypt xdebug

RUN echo "memory_limit = -1" > /usr/local/etc/php/conf.d/memory.ini

COPY . /var/www/html
WORKDIR /var/www/html

RUN composer install --prefer-dist --optimize-autoloader
19 changes: 18 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,24 @@
version: '2'
version: '3.2'
services:
dcore:
container_name: dcore
build: ./test-dcore-node
ports:
- "8090:8090"
expose:
- "8090"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8090"]
interval: 5s
timeout: 10s
retries: 10
# used for debug
# entrypoint: ['/bin/sh', '-c', 'while true; do sleep 2; date; done']
php:
container_name: php-sdk
build: .
depends_on:
- dcore
tty: true
volumes:
- '.:/var/www/html'
Expand Down
2 changes: 1 addition & 1 deletion src/Net/Model/Request/GetAccount.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ abstract class GetAccount extends BaseRequest
*/
public static function responseToModel(BaseResponse $response)
{
return self::resultToModel($response->getResult());
return $response->getResult() ? self::resultToModel($response->getResult()) : null;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Net/Model/Request/GetAccountById.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public function __construct(ChainObject $id)
);
}

public static function responseToModel(BaseResponse $response): Account
public static function responseToModel(BaseResponse $response): ?Account
{
$rawAccounts = $response->getResult();
$response->setResult(reset($rawAccounts));
Expand Down
4 changes: 4 additions & 0 deletions test-dcore-node/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM decentnetwork/dcore.ubuntu:test

COPY --chown=dcore:dcore ./datadir /home/dcore/.decent/data/decentd
COPY --chown=dcore:dcore ./genesis-local.json /home/dcore/.decent/genesis.json
138 changes: 138 additions & 0 deletions test-dcore-node/datadir/config.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
# Endpoint for P2P node to listen on
# p2p-endpoint =

# P2P nodes to connect to on startup (may specify multiple times)
# seed-node =

# Pairs of [BLOCK_NUM,BLOCK_ID] that should be enforced as checkpoints.
# checkpoint =

# Endpoint for websocket RPC to listen on
rpc-endpoint = 127.0.0.1:8090

# Endpoint for TLS websocket RPC to listen on
# rpc-tls-endpoint =

# Enable support for per-message deflate compression in the websocket servers (--rpc-endpoint and --rpc-tls-endpoint), disabled by default
# enable-permessage-deflate =

# List of allowed domains to comunicate with or asterix for all domains
# server-allowed-domains =

# The TLS certificate file (public) for this server
# server-cert-file =

# The TLS certificate file (private key) for this server
# server-cert-key-file =

# The TLS certificate chain file for this server
# server-cert-chain-file =

# Password for this certificate
# server-cert-password =

# File to read Genesis State from
genesis-json = .decent/genesis.json

# Block signing key to use for init miners, overrides genesis file
# dbg-init-key =

# JSON file specifying API permissions
# api-access =

# IPFS control API
# ipfs-api =

# Enable block production, even if the chain is stale.
enable-stale-production = true

# Percent of miners (0-99) that must be participating in order to produce blocks
required-miners-participation = 0

# ID of miner controlled by this node (may specify multiple times), e.g. 1.4.5
# miner-id =
miner-id = "1.4.1"
miner-id = "1.4.2"
miner-id = "1.4.3"
miner-id = "1.4.4"
miner-id = "1.4.5"
miner-id = "1.4.6"
miner-id = "1.4.7"
miner-id = "1.4.8"
miner-id = "1.4.9"
miner-id = "1.4.10"
miner-id = "1.4.11"

# Miner WIF private key (may specify multiple times), e.g. 5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3
# miner-private-key =

# DEPRECATED: Tuple of [PublicKey, WIF private key] (may specify multiple times), e.g. [DCT6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV,5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3]
# private-key =
private-key=["DCT82MTCQVa9TDFmz3ZwaLzsFAmCLoJzrtFugpF72vsbuE1CpCwKy","5JuJbrKZgAATcouJnwpaxPbHMAMDXSgUpQSfxTXzkSUufcnpTUa"]

# Account ID to track history for (may specify multiple times)
# track-account =

# ID of account controlling this seeder, e.g. 1.2.15
# seeder =

# Private key of the account controlling this seeder
# seeder-private-key =

# El Gamal content private key
# content-private-key =

# Allocated disk space, in MegaBytes
# free-space =

# Packages storage path
# packages-path =

# Price amount per MegaBytes
# seeding-price =

# Seeding price asset
seeding-symbol = DCT

# Optional ISO 3166-1 alpha-2 two-letter region code
# region-code =

# Enable transaction lookup by transaction ID
transaction-id-history = false

# declare an appender named "stderr" that writes messages to the console
[log.console_appender.stderr]
stream=std_error

# declare an appender named "default" that writes messages to decentd.log
[log.file_appender.default]
filename=logs/decentd.log
rotation_interval=86400
rotation_limit=864000

# declare an appender named "p2p" that writes messages to p2p.log
[log.file_appender.p2p]
filename=logs/p2p.log
rotation_interval=86400
rotation_limit=864000

# declare an appender named "rpc" that writes messages to rpc.log
[log.file_appender.rpc]
filename=logs/rpc.log
rotation_interval=86400
rotation_limit=864000

# route messages sent to the "default" logger to the default appender declared above
[logger.default]
level=info
appenders=stderr,default

# route messages sent to the "p2p" logger to the p2p appender declared above
[logger.p2p]
level=error
appenders=p2p

# route messages sent to the "rpc" logger to the rpc appender declared above
[logger.rpc]
level=error
appenders=rpc
Loading