Tucsky / aggr

Cryptocurrency trades aggregator
https://charts.aggr.trade/
GNU General Public License v3.0
811 stars 232 forks source link

Docker Build is broken #324

Closed TraderApophis closed 10 months ago

TraderApophis commented 1 year ago

Describe the issue

Building inside docker from a clone of the repo is broken. Error shown below.

...

Steps to reproduce

root@###:/# git clone https://github.com/Tucsky/aggr
Cloning into 'aggr'...
remote: Enumerating objects: 6980, done.
remote: Counting objects: 100% (924/924), done.
remote: Compressing objects: 100% (393/393), done.
remote: Total 6980 (delta 566), reused 797 (delta 524), pack-reused 6056
Receiving objects: 100% (6980/6980), 4.93 MiB | 13.21 MiB/s, done.
Resolving deltas: 100% (5380/5380), done.
root@###:/# cd aggr
root@###:/# docker build -t aggr-chart .
[+] Building 4.0s (13/16)
 => [internal] load .dockerignore                                                                                                                                      0.0s
 => => transferring context: 2B                                                                                                                                        0.0s
 => [internal] load build definition from Dockerfile                                                                                                                   0.0s
 => => transferring dockerfile: 464B                                                                                                                                   0.0s
 => [internal] load metadata for docker.io/library/nginx:stable-alpine                                                                                                 0.8s
 => [internal] load metadata for docker.io/library/node:lts-alpine                                                                                                     0.8s
 => [internal] load build context                                                                                                                                      0.1s
 => => transferring context: 8.46MB                                                                                                                                    0.1s
 => CACHED [production-stage 1/4] FROM docker.io/library/nginx:stable-alpine@sha256:b7db705c8986070be8aa99ec0886886ddb3c75b1e46301f54865b16db79e9e52                   0.0s
 => [build-stage 1/7] FROM docker.io/library/node:lts-alpine@sha256:1ccc70acda680aa4ba47f53e7c40b2d4d6892de74817128e0662d32647dd7f4d                                   0.0s
 => CACHED [build-stage 2/7] WORKDIR /app                                                                                                                              0.0s
 => CACHED [build-stage 3/7] RUN apk --no-cache add git                                                                                                                0.0s
 => CACHED [build-stage 4/7] COPY package*.json ./                                                                                                                     0.0s
 => CACHED [build-stage 5/7] RUN npm install                                                                                                                           0.0s
 => [build-stage 6/7] COPY . .                                                                                                                                         0.0s
 => ERROR [build-stage 7/7] RUN npm run build                                                                                                                          3.1s
------
 > [build-stage 7/7] RUN npm run build:
#0 0.450
#0 0.450 > aggr@3.3.2 build
#0 0.450 > vue-cli-service build
#0 0.450
#0 0.903
#0 0.904 -  Building for production...
#0 2.049 Error: error:0308010C:digital envelope routines::unsupported
#0 2.049     at new Hash (node:internal/crypto/hash:71:19)
#0 2.049     at Object.createHash (node:crypto:133:10)
#0 2.049     at module.exports (/app/node_modules/webpack/lib/util/createHash.js:135:53)
#0 2.049     at NormalModule._initBuildHash (/app/node_modules/webpack/lib/NormalModule.js:417:16)
#0 2.049     at handleParseError (/app/node_modules/webpack/lib/NormalModule.js:471:10)
#0 2.049     at /app/node_modules/webpack/lib/NormalModule.js:503:5
#0 2.049     at /app/node_modules/webpack/lib/NormalModule.js:358:12
#0 2.049     at /app/node_modules/loader-runner/lib/LoaderRunner.js:373:3
#0 2.049     at iterateNormalLoaders (/app/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
#0 2.049     at iterateNormalLoaders (/app/node_modules/loader-runner/lib/LoaderRunner.js:221:10)
#0 2.049     at /app/node_modules/loader-runner/lib/LoaderRunner.js:236:3
#0 2.049     at runSyncOrAsync (/app/node_modules/loader-runner/lib/LoaderRunner.js:130:11)
#0 2.049     at iterateNormalLoaders (/app/node_modules/loader-runner/lib/LoaderRunner.js:232:2)
#0 2.049     at Array.<anonymous> (/app/node_modules/loader-runner/lib/LoaderRunner.js:205:4)
#0 2.049     at Storage.finished (/app/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:55:16)
#0 2.049     at /app/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:91:9
#0 3.063 /app/node_modules/loader-runner/lib/LoaderRunner.js:114
#0 3.063                        throw e;
#0 3.063                        ^
#0 3.063
#0 3.063 Error: error:0308010C:digital envelope routines::unsupported
#0 3.063     at new Hash (node:internal/crypto/hash:71:19)
#0 3.063     at Object.createHash (node:crypto:133:10)
#0 3.063     at module.exports (/app/node_modules/webpack/lib/util/createHash.js:135:53)
#0 3.063     at NormalModule._initBuildHash (/app/node_modules/webpack/lib/NormalModule.js:417:16)
#0 3.063     at handleParseError (/app/node_modules/webpack/lib/NormalModule.js:471:10)
#0 3.063     at /app/node_modules/webpack/lib/NormalModule.js:503:5
#0 3.063     at /app/node_modules/webpack/lib/NormalModule.js:358:12
#0 3.063     at /app/node_modules/loader-runner/lib/LoaderRunner.js:373:3
#0 3.063     at iterateNormalLoaders (/app/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
#0 3.063     at iterateNormalLoaders (/app/node_modules/loader-runner/lib/LoaderRunner.js:221:10)
#0 3.063     at /app/node_modules/loader-runner/lib/LoaderRunner.js:236:3
#0 3.063     at context.callback (/app/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
#0 3.063     at /app/node_modules/cache-loader/dist/index.js:147:7
#0 3.063     at /app/node_modules/graceful-fs/graceful-fs.js:61:14
#0 3.063     at FSReqCallback.oncomplete (node:fs:198:23) {
#0 3.063   opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
#0 3.063   library: 'digital envelope routines',
#0 3.063   reason: 'unsupported',
#0 3.063   code: 'ERR_OSSL_EVP_UNSUPPORTED'
#0 3.063 }
#0 3.063
#0 3.063 Node.js v18.16.0
------
Dockerfile:8
--------------------
   6 |     RUN npm install
   7 |     COPY . .
   8 | >>> RUN npm run build
   9 |
  10 |     # production stage
--------------------
ERROR: failed to solve: process "/bin/sh -c npm run build" did not complete successfully: exit code: 1
adeacetis commented 1 year ago

Hey, Current packaged webpack version  doesn't with node > 17 as it doesn't satisfy the upgraded OpenSSL standard in NJS 17 and above.

There is a workaround using sys env variable.We are currently upgrading the stack to Víte and NodeJS 20 in the new dev branch and this fixes this issue. Note that it won't make it to master before several users tested the new stack and that we tested that everything works as expected. Will come back to you asap. Cheers

TraderApophis commented 1 year ago

I would appreciate if you could explain the work around using environment variable. I have tried building from the 'dev' branch and get other unrelated errors.

adeacetis commented 1 year ago

I am very sorry. It's a very unstable week for me and there's indeed a lots of things broken. It's 100% my fault. There is open PRs that need to be merged into dev.

I have created a bit of a mess in the repo past days trying to do too much.

Please join Discord https://discord.gg/zbMUj52G and you'll see the update there.

adeacetis commented 1 year ago

Here's an SO reply (https://stackoverflow.com/a/74488988) that explains how to run webpack 4 on Node 17 and above.

TraderApophis commented 1 year ago

Yeah I have tried that environment variable and still get issues with missing files when trying to do npm run build. I am not a node expert so I think I might have to wait until master is fixed.

adeacetis commented 1 year ago

Have you tried to install Volta and run the branch locally w/o Docker?Sent from Outlook for AndroidFrom: TraderApophis @.>Sent: Thursday, June 1, 2023 4:15:51 pmTo: Tucsky/aggr @.>Cc: Axel De Acetis @.>; Comment @.>Subject: Re: [Tucsky/aggr] Docker Build is broken (Issue #324) Yeah I have tried that environment variable and still get issues with missing files when trying to do npm run build. I am not a node expert so I think I might have to wait until master is fixed.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.***>

TraderApophis commented 1 year ago

I have tried to build locally on Ubuntu 22.04 LTS.

I get this error when doing npm run build

`$ npm run build

aggr@3.3.2 build /data/external-repos/aggr vue-cli-service build

sh: 1: vue-cli-service: Permission denied npm ERR! code ELIFECYCLE npm ERR! errno 126 npm ERR! aggr@3.3.2 build: vue-cli-service build npm ERR! Exit status 126 npm ERR! npm ERR! Failed at the aggr@3.3.2 build script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above. `

I think I have installed volta ok, not sure if vue-cli is install correctly though. I did install using:

npm install -g @vue/cli npm install create-vue@latest

I have tried removing node_modules and package-lock.json and doing npm install again. I have also tried chmod a+x on node_modules and same issue. Even if I chmod 777 the whole repo I still get permission issue.

TraderApophis commented 1 year ago

Entirely possible these problems are to do with my local environment and nothing to do with the repo. Hence why I wanted to use the docker image :)

adeacetis commented 1 year ago

What about?

chmod -R a+x node_modules

TraderApophis commented 1 year ago

Yes, sorry I did apply the perms recursively. Still same issue.

adeacetis commented 1 year ago

Hello,

I have proposed a fix for the Docker setup here #330

You will need to install volta.sh.

Check out the PR branch, then type in the terminal:

docker build -t aggr-ui -f ./Dockerfile .
docker run -p 3001:80 aggr-ui

This should work right off the bat. There are some functionalities that will not work at this point in time: alerts and historical data.

In order to fix that, you would have to run aggr-server. I will prepare some documentation to help you guys out with the configuration. Please test it out for me, I need some review. Thank you.

adeacetis commented 10 months ago

Fixes are about to go live with release 3.4.0 #360