diff --git a/.gitattributes b/.gitattributes index bf55f92..4b85626 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,7 +1,8 @@ -# Autodetect text files -* text=auto +# Ensure text files uses LF. +* text=lf -# Ensure shell script uses LF. +# Ensure shell script uses LF and bat script CRLF. Dockerfile eol=lf *.sh eol=lf -.env eol=lf \ No newline at end of file +*.bat eol=crlf +.env eol=lf diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 44b1850..0000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "wallet-daemon"] - path = wallet-daemon - url = https://github.com/enjin/wallet-daemon.git \ No newline at end of file diff --git a/configs/core/Dockerfile b/configs/core/Dockerfile index eab0650..0a561c9 100644 --- a/configs/core/Dockerfile +++ b/configs/core/Dockerfile @@ -1,5 +1,5 @@ # Stage: setup-web-server -FROM php:apache-buster as setup-web-server +FROM php:apache-buster AS setup-web-server # Install dependencies RUN apt-get update -y && \ @@ -20,7 +20,7 @@ RUN docker-php-ext-install ffi pdo pdo_mysql gmp bcmath sodium mysqli sockets pc RUN docker-php-ext-enable redis imagick # Stage: create-application -FROM setup-web-server as create-application +FROM setup-web-server AS create-application WORKDIR /app/ COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer @@ -32,7 +32,7 @@ COPY configs/core/config/ /app/laravel-application/config/ COPY configs/core/routes/ /app/laravel-application/routes/ # Stage: composer-update -FROM create-application as composer-update +FROM create-application AS composer-update RUN cd laravel-application && \ composer update --prefer-dist --no-dev --optimize-autoloader --no-interaction --ignore-platform-reqs @@ -41,7 +41,7 @@ RUN cd laravel-application && \ RUN cd /app/laravel-application/vendor/gmajor/sr25519-bindings/go && go build -buildmode=c-shared -o sr25519.so . && mv sr25519.so ../src/Crypto/sr25519.so # Stage: http setup -FROM create-application as http-setup +FROM create-application AS http-setup # Set ServerName to be localhost. RUN echo 'ServerName localhost' >> /etc/apache2/apache2.conf @@ -69,7 +69,7 @@ COPY configs/core/php /usr/local/etc/php/conf.d COPY configs/core/supervisor /etc/supervisor # Stage: platform-core -FROM http-setup as enjin-platform +FROM http-setup AS enjin-platform LABEL org.opencontainers.image.source=https://github.com/enjin/platform LABEL org.opencontainers.image.description="Enjin Platform - The most powerful and advanced open-source framework for building NFT platforms." @@ -77,8 +77,8 @@ LABEL org.opencontainers.image.licenses=LGPL-3.0-only WORKDIR /var/www/html -COPY configs/core/start.sh /usr/local/bin/start -RUN dos2unix /usr/local/bin/start +COPY configs/core/start.sh /usr/local/bin/start.sh +RUN dos2unix /usr/local/bin/start.sh USER www-data -CMD ["/usr/local/bin/start"] +CMD ["/usr/local/bin/start.sh"] diff --git a/docker-compose.yml b/docker-compose.yml index 21d9295..518048c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -27,7 +27,7 @@ services: - "${REDIS_EXTERNAL_PORT}:6379" decoder: - platform: linux/x86_64 + platform: linux/amd64 image: enjin/platform-decoder:latest restart: unless-stopped ports: @@ -107,10 +107,8 @@ services: - "host.docker.internal:host-gateway" daemon: - image: enjin/daemon:latest - build: - context: ./wallet-daemon - dockerfile: Dockerfile + platform: linux/amd64 + image: enjin/wallet-daemon:latest restart: unless-stopped env_file: - ./configs/daemon/.env diff --git a/start.bat b/start.bat index f0295f5..1ee7ec7 100644 --- a/start.bat +++ b/start.bat @@ -64,7 +64,7 @@ goto :EOF :check_and_generate_app_key :: Check if $APP_KEY is already set set "APP_KEY=" -for /f "tokens=2 delims==" %%i in ('findstr /r /c:"APP_KEY=" configs\core\.env') do ( +for /f "tokens=2 delims==" %%i in ('findstr /r /c:"^APP_KEY=" configs\core\.env') do ( set "APP_KEY=%%i" ) :: If not set, generate a new key automatically @@ -128,7 +128,7 @@ for /f "tokens=2 delims==" %%i in ('findstr /r /c:"DAEMON_ACCOUNT=" configs\core if "%DAEMON_ACCOUNT%"=="" ( echo Let's get your wallet daemon address, please wait... (docker compose up -d daemon) - for /f "delims=" %%a in ('docker compose logs daemon 2^>^&1 ^| findstr /r /c:"Efinity:"') do ( + for /f "delims=" %%a in ('docker compose logs daemon 2^>^&1 ^| findstr /r /c:"Matrix:"') do ( for %%w in (%%a) do set "WALLET_ADDRESS=%%w" ) echo Your wallet daemon address is: !WALLET_ADDRESS! @@ -187,25 +187,19 @@ goto :EOF :MAIN echo Welcome to Enjin Platform, this script will help you start it up call :check_git_is_installed - -:: Initialize Git submodules -git submodule update --init - call :check_has_app_url call :check_has_basic_token call :check_has_daemon_password call :check_and_generate_app_key - -:: Build the daemon container -docker compose build daemon call :get_daemon_address :: Prompt the user to start platform services set /p start_services=Do you want to start all platform services? (y/n) if /i "%start_services%"=="y" ( - docker compose build + docker compose build app --no-cache docker compose up -d - echo Your Enjin Platform is now running, please visit: http://127.0.0.1:8000 + echo Your Enjin Platform is now installing the UI and other dependencies... + echo It should be available in a few minutes at: http://127.0.0.1:8000 ) else ( docker compose down echo Please run this script again when you are ready diff --git a/start.sh b/start.sh index a7a1677..b0cfaa0 100755 --- a/start.sh +++ b/start.sh @@ -110,9 +110,14 @@ get_daemon_address() { DAEMON_ACCOUNT=$(awk '$1 ~ /^DAEMON_ACCOUNT/' configs/core/.env | cut -d "=" -f 2) if [ -z "$DAEMON_ACCOUNT" ]; then echo "Let's get your wallet daemon address, please wait..." + (docker compose up -d daemon) - WALLET_ADDRESS=$(docker compose logs daemon 2>&1 | grep "Efinity:" | awk '{print $NF}' | tail -n 1) - echo "Your wallet daemon address is: $WALLET_ADDRESS" + sleep 3 + + WALLET_ADDRESS=$(docker compose logs daemon 2>&1 | grep -A2 "Wallet daemon address" | awk '{print $NF}' | tail -n 2) + echo "Your wallet daemon address is:" + echo "$WALLET_ADDRESS" + WALLET_ADDRESS=$(echo "$WALLET_ADDRESS" | head -n 1) if [ "$PLATFORM_OS" = "macOS" ]; then sed -i '' -e "s/^DAEMON_ACCOUNT=/DAEMON_ACCOUNT=$WALLET_ADDRESS/g" configs/core/.env @@ -160,30 +165,27 @@ check_git_is_installed() { } echo "Welcome to Enjin Platform, this script will help you start it up" + detect_user_os check_git_is_installed check_openssl_is_installed check_docker_is_installed check_compose_is_installed check_docker_is_running - -git submodule update --init - check_has_app_url check_has_basic_token check_has_daemon_password check_and_generate_app_key - -docker compose build daemon get_daemon_address echo "Do you want to start all platform services? (y/n)" read start_services if [ "$start_services" != "${start_services#[Yy]}" ] ;then - docker compose build + docker compose build app --no-cache docker compose up -d - echo "Your Enjin Platform is now running, please visit: http://127.0.0.1:8000" + echo "Your Enjin Platform is now installing the UI and other dependencies..." + echo "It should be available in a few minutes at: http://127.0.0.1:8000 " else docker compose down echo "Please run this script again when you are ready"