upstage-org / upstage

UpStage is a platform for cyberformance: remote players combine digital media in real-time for an online audience. All you need is a web browser!
https://upstage.org.nz
GNU General Public License v3.0
21 stars 0 forks source link

Unable to install on Debian 12 Bookworm #1324

Open emrahcom opened 3 months ago

emrahcom commented 3 months ago

I have an up-to-date Debian 12 Bookworm VM. I installed nodejs and yarn.

My /etc/apt/sources.list.d/nodesource.list:

deb [signed-by=/usr/share/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main

My /etc/apt/sources.list.d/yarn.list

deb [signed-by=/usr/share/keyrings/yarn.gpg] https://dl.yarnpkg.com/debian/ stable main

These are the installed versions:

% nodejs --version
v20.17.0

% npm --version
10.8.2

% yarn --version
1.22.22

I cloned the repo and installed Python modules without any problem. I ran the followings by using a normal user account (which is upstage in my case):

% whoami
upstage

% pwd
/home/upstage

% git clone https://github.com/upstage-org/upstage.git
% cd upstage
% pip install -r core/requirements.pip

When I tried to build dashboard, it failed. Looks like it doesn't support node 20

% cd dashboard
% pwd
/home/upstage/upstage/dashboard
% yarn
yarn install v1.22.22
[1/4] Resolving packages...
[2/4] Fetching packages...
error @achrinza/node-ipc@9.2.2: The engine "node" is incompatible with this module. Expected version "8 || 10 || 12 || 14 || 16 || 17". Got "20.17.0"
error Found incompatible module.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

When I tried to build studio, I had the following issues:

% cd /home/upstage/upstage/studio
% yarn
yarn install v1.22.22
[1/4] Resolving packages...
[2/4] Fetching packages...
warning Pattern ["strip-ansi@^6.0.1"] is trying to unpack in the same destination "/home/upstage/.cache/yarn/v6/npm-strip-ansi-cjs-6.0.1-9e26c63d30f53443e9489495b2105d37b67a85d9-integrity/node_modules/strip-ansi-cjs" as pattern ["strip-ansi-cjs@npm:strip-ansi@^6.0.1"]. This could result in non-deterministic behavior, skipping.
warning Pattern ["string-width@^4.1.0"] is trying to unpack in the same destination "/home/upstage/.cache/yarn/v6/npm-string-width-cjs-4.2.3-269c7117d27b05ad2e536830a8ec895ef9c6d010-integrity/node_modules/string-width-cjs" as pattern ["string-width-cjs@npm:string-width@^4.2.0"]. This could result in non-deterministic behavior, skipping.
warning Pattern ["strip-ansi@^6.0.0"] is trying to unpack in the same destination "/home/upstage/.cache/yarn/v6/npm-strip-ansi-cjs-6.0.1-9e26c63d30f53443e9489495b2105d37b67a85d9-integrity/node_modules/strip-ansi-cjs" as pattern ["strip-ansi-cjs@npm:strip-ansi@^6.0.1"]. This could result in non-deterministic behavior, skipping.
warning Pattern ["string-width@^4.2.0"] is trying to unpack in the same destination "/home/upstage/.cache/yarn/v6/npm-string-width-cjs-4.2.3-269c7117d27b05ad2e536830a8ec895ef9c6d010-integrity/node_modules/string-width-cjs" as pattern ["string-width-cjs@npm:string-width@^4.2.0"]. This could result in non-deterministic behavior, skipping.
[3/4] Linking dependencies...
warning " > @tiptap/extension-image@2.2.4" has unmet peer dependency "@tiptap/core@^2.0.0".
warning " > @tiptap/extension-link@2.2.4" has unmet peer dependency "@tiptap/core@^2.0.0".
warning " > @tiptap/extension-placeholder@2.2.4" has unmet peer dependency "@tiptap/core@^2.0.0".
warning " > @tiptap/vue-3@2.2.4" has unmet peer dependency "@tiptap/core@^2.0.0".
warning "@tiptap/vue-3 > @tiptap/extension-bubble-menu@2.2.4" has unmet peer dependency "@tiptap/core@^2.0.0".
warning "@tiptap/vue-3 > @tiptap/extension-floating-menu@2.2.4" has unmet peer dependency "@tiptap/core@^2.0.0".
warning " > sass-loader@8.0.2" has unmet peer dependency "webpack@^4.36.0 || ^5.0.0".
[4/4] Building fresh packages...
Done in 6.17s.

% yarn build
yarn run v1.22.22                                                                                                                                                             
$ vue-tsc --noEmit --skipLibCheck && vite build                                                                                                                               
src/components/media/MediaTable.vue:374:71 - error TS2339: Property 'username' does not exist on type 'never'.
374           <a-space v-if="isAdmin || record.owner.username === whoami?.username">   
                                                                          ~~~~~~~~                                                                                            
src/components/Navbar.vue:29:62 - error TS2339: Property 'roleName' does not exist on type 'never'.
29         <span class="text-gray-500 cursor-pointer">{{ whoami.roleName }}</span>     
                                                                ~~~~~~~~                                                                                                      
src/components/Navbar.vue:32:23 - error TS2339: Property 'displayName' does not exist on type 'never'.
32             {{ whoami.displayName || whoami.username }}                             
                         ~~~~~~~~~~~                                                                                                                                          
src/components/Navbar.vue:32:45 - error TS2339: Property 'username' does not exist on type 'never'.
32             {{ whoami.displayName || whoami.username }}
                                               ~~~~~~~~                                                                                                                       
src/components/Sidebar.vue:28:24 - error TS2339: Property 'role' does not exist on type 'never'.
28           whoami.value.role,            
                          ~~~~                                                                                                                                                
src/components/Sidebar.vue:130:50 - error TS2339: Property 'manual' does not exist on type 'never'.
130                     settings.state.value.system?.manual ??                         
                                                     ~~~~~~                                                                                                                   
src/hooks/mutations.ts:2:39 - error TS2307: Cannot find module 'genql/studio' or its corresponding type declarations.
2 import { UpdateUserInput, User } from "genql/studio";
src/services/graphql/fetcher.ts:2:30 - error TS2307: Cannot find module 'genql/studio' or its corresponding type declarations.

2 import { createClient } from "genql/studio";
                               ~~~~~~~~~~~~~~
src/services/graphql/index.ts:2:52 - error TS2307: Cannot find module 'genql/studio' or its corresponding type declarations.
2 import { createClient as createStudioClient } from "genql/studio";
                                                     ~~~~~~~~~~~~~~
src/services/graphql/index.ts:3:52 - error TS2307: Cannot find module 'genql/config' or its corresponding type declarations.
3 import { createClient as createConfigClient } from "genql/config";
                                                     ~~~~~~~~~~~~~~
src/state/auth.ts:6:22 - error TS2307: Cannot find module 'genql/studio' or its corresponding type declarations.
6 import { User } from "genql/studio";
                       ~~~~~~~~~~~~~~
src/state/auth.ts:28:19 - error TS2339: Property 'role' does not exist on type 'never'. 
28     whoami.value?.role ?? 0,
                     ~~~~
src/views/admin/configuration/index.vue:38:42 - error TS2339: Property 'title' does not exist on type 'never'.
38         defaultValue: state.value.foyer?.title ?? "",
                                            ~~~~~
src/views/admin/configuration/index.vue:44:42 - error TS2339: Property 'description' does not exist on type 'never'.
44         defaultValue: state.value.foyer?.description ?? "",
                                            ~~~~~~~~~~~
src/views/admin/configuration/index.vue:51:42 - error TS2339: Property 'menu' does not exist on type 'never'.
51         defaultValue: state.value.foyer?.menu ?? "",
                                            ~~~~
src/views/admin/configuration/index.vue:65:41 - error TS2339: Property 'showRegistration' does not exist on type 'never'.
65         defaultValue: state.value.foyer.showRegistration ?? false,
                                           ~~~~~~~~~~~~~~~~
src/views/admin/configuration/index.vue:70:42 - error TS2339: Property 'enableDonate' does not exist on type 'never'.
70         defaultValue: state.value.system.enableDonate ?? false,
                                            ~~~~~~~~~~~~
src/views/admin/configuration/index.vue:81:42 - error TS2339: Property 'termsOfService' does not exist on type 'never'.
81         defaultValue: state.value.system.termsOfService ?? "",
                                            ~~~~~~~~~~~~~~
src/views/admin/configuration/index.vue:86:42 - error TS2339: Property 'manual' does not exist on type 'never'.
86         defaultValue: state.value.system.manual ?? "",
                                            ~~~~~~
src/views/admin/configuration/index.vue:94:42 - error TS2339: Property 'esp' does not exist on type 'never'.
94         defaultValue: state.value.system.esp ?? "",
                                            ~~~
src/views/admin/email-notifications/index.vue:42:40 - error TS2339: Property 'edges' does not exist on type 'never'.
42         !receivers.value.adminPlayers?.edges.some(
                                          ~~~~~
src/views/admin/email-notifications/index.vue:43:12 - error TS7006: Parameter 'e' implicitly has an 'any' type.
43           (e) => e?.node?.email === email,
              ~
src/views/admin/email-notifications/index.vue:89:7 - error TS2347: Untyped function calls may not accept type arguments.
 89       receivers.value.adminPlayers?.edges.map<TransferItem>((user, i) => ({
          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 90         key: user?.node?.email ?? `${i}`,
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
93           : "",
    ~~~~~~~~~~~~~~~
 94       })) ?? [],
    ~~~~~~~~~
src/views/admin/email-notifications/index.vue:89:37 - error TS2339: Property 'edges' does not exist on type 'never'.
89       receivers.value.adminPlayers?.edges.map<TransferItem>((user, i) => ({
                                       ~~~~~
src/views/admin/email-notifications/index.vue:89:62 - error TS7006: Parameter 'user' implicitly has an 'any' type.
89       receivers.value.adminPlayers?.edges.map<TransferItem>((user, i) => ({
                                                                ~~~~
src/views/admin/email-notifications/index.vue:89:68 - error TS7006: Parameter 'i' implicitly has an 'any' type.
89       receivers.value.adminPlayers?.edges.map<TransferItem>((user, i) => ({
                                                                      ~
src/views/admin/email-notifications/index.vue:116:37 - error TS2339: Property 'edges' does not exist on type 'never'.
116       receivers.value.adminPlayers?.edges.some(
                                        ~~~~~
src/views/admin/email-notifications/index.vue:117:10 - error TS7006: Parameter 'edge' implicitly has an 'any' type.
117         (edge) => edge?.node?.email === email,
             ~~~~
src/views/admin/player-management/ChangePassword.vue:11:22 - error TS2307: Cannot find module 'genql/studio' or its corresponding type declarations.
11 import { User } from "genql/studio";
                        ~~~~~~~~~~~~~~
src/views/admin/player-management/DeletePlayer.vue:9:22 - error TS2307: Cannot find module 'genql/studio' or its corresponding type declarations.

9 import { User } from "genql/studio";
                       ~~~~~~~~~~~~~~

src/views/admin/player-management/PlayerForm.vue:22:43 - error TS2307: Cannot find module 'genql/studio' or its corresponding type declarations.

22 import { ChangePasswordInput, User } from "genql/studio";
                                             ~~~~~~~~~~~~~~
src/views/admin/player-management/PlayerTable.vue:19:43 - error TS2307: Cannot find module 'genql/studio' or its corresponding type declarations.
19 import { AdminPlayerSortEnum, User } from "genql/studio";
                                             ~~~~~~~~~~~~~~
src/views/admin/player-management/PlayerTable.vue:311:52 - error TS2339: Property 'edges' does not exist on type 'never'.
311             dataSource: result.value.adminPlayers?.edges.map((e) => e?.node),
                                                       ~~~~~
src/views/admin/player-management/PlayerTable.vue:311:63 - error TS7006: Parameter 'e' implicitly has an 'any' type.
311             dataSource: result.value.adminPlayers?.edges.map((e) => e?.node),
                                                                  ~
src/views/admin/player-management/PlayerTable.vue:318:45 - error TS2339: Property 'totalCount' does not exist on type 'never'.
318                 ? result.value.adminPlayers.totalCount
                                                ~~~~~~~~~~

Found 35 errors in 13 files.

Errors  Files
     1  src/components/media/MediaTable.vue:374
     3  src/components/Navbar.vue:29
     2  src/components/Sidebar.vue:28
     1  src/hooks/mutations.ts:2
     1  src/services/graphql/fetcher.ts:2
     2  src/services/graphql/index.ts:2
     2  src/state/auth.ts:6
     8  src/views/admin/configuration/index.vue:38
     8  src/views/admin/email-notifications/index.vue:42
     1  src/views/admin/player-management/ChangePassword.vue:11
     1  src/views/admin/player-management/DeletePlayer.vue:9
     1  src/views/admin/player-management/PlayerForm.vue:22
     4  src/views/admin/player-management/PlayerTable.vue:19
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

So, how can I install it? Should I use a specific version of nodejs or Linux distribution?

gloriajw commented 3 months ago

Version 16 is recommended.

emrahcom commented 3 months ago

I deleted node 20 and installed node 16.

My current /etc/apt/sources.list.d/nodesource.list:

deb [signed-by=/usr/share/keyrings/nodesource.gpg] https://deb.nodesource.com/node_16.x nodistro main

The versions:

% nodejs --version
v16.20.2

% npm --version
8.19.4

% yarn --version
1.22.22

I removed the old clone and cloned the repo again, installed Python modules. Now I have the following for dashboard:

% pwd
/home/upstage/upstage/dashboard

% yarn
yarn install v1.22.22
[1/4] Resolving packages...
success Already up-to-date.
Done in 0.34s.

% yarn build
 ERROR  Failed to compile with 2 errors                                                                                                                             4:51:29 PM

 error  

Template execution failed: ReferenceError: VUE_APP_JITSI_ENDPOINT is not defined

  ReferenceError: VUE_APP_JITSI_ENDPOINT is not defined

  - index.html:108 
    /home/upstage/upstage/dashboard/public/index.html:108:11

  - index.html:111 0971.module.exports
    /home/upstage/upstage/dashboard/public/index.html:111:3

  - index.js:284 
    [dashboard]/[html-webpack-plugin]/index.js:284:18

 ERROR  Build failed with errors.
error Command failed with exit code 1.

That is OK, I think I should set some environment variables before building. I will check it later.

For studio:

% pwd
/home/upstage/upstage/studio

% yarn                  
yarn install v1.22.22
[1/4] Resolving packages...
success Already up-to-date.
Done in 0.18s.

% yarn genql
yarn run v1.22.22
$ genql --endpoint $(grep VITE_GRAPHQL_ENDPOINT .env)studio_graphql/ --output ./src/genql/studio && genql --endpoint $(grep VITE_GRAPHQL_ENDPOINT .env)config_graphql/ --output ./src/genql/config
grep: .env: No such file or directory
/home/upstage/upstage/studio/node_modules/yargs/build/lib/usage.js:12
const stringWidth = require("string-width");
                    ^

Error [ERR_REQUIRE_ESM]: require() of ES Module /home/upstage/upstage/studio/node_modules/string-width/index.js from /home/upstage/upstage/studio/node_modules/yargs/build/lib/usage.js not supported.
Instead change the require of index.js in /home/upstage/upstage/studio/node_modules/yargs/build/lib/usage.js to a dynamic import() which is available in all CommonJS modules.
    at Object.<anonymous> (/home/upstage/upstage/studio/node_modules/yargs/build/lib/usage.js:12:21)
    at Object.<anonymous> (/home/upstage/upstage/studio/node_modules/yargs/build/lib/yargs.js:7:17)
    at Object.<anonymous> (/home/upstage/upstage/studio/node_modules/yargs/yargs.js:7:27)
    at Object.<anonymous> (/home/upstage/upstage/studio/node_modules/yargs/index.js:5:15)
    at Object.<anonymous> (/home/upstage/upstage/studio/node_modules/@genql/cli/dist/cli.js:9:33) {
  code: 'ERR_REQUIRE_ESM'
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

What should I do now to fix this?

gloriajw commented 3 months ago

You're missing an .env file in the studio dir, which looks like this:

VITE_API_ENDPOINT=http://localhost/api/ VITE_GRAPHQL_ENDPOINT=http://localhost/api/ VITE_STATIC_ASSETS_ENDPOINT=http://localhost/static/assets/ VITE_STUDIO_ENDPOINT=/stages/ VITE_MQTT_NAMESPACE=dev VITE_MQTT_ENDPOINT= VITE_MQTT_USERNAME= VITE_MQTT_PASSWORD= VITE_STREAMING_PUBLISH_ENDPOINT=not_used VITE_STREAMING_SUBSCRIBE_ENDPOINT=not_used VITE_STREAMING_USERNAME= VITE_STREAMING_PASSWORD= VITE_JITSI_ENDPOINT= VITE_CLOUDFLARE_CAPTCHA_SITEKEY=

emrahcom commented 3 months ago

yarn genql has still the same error (Error [ERR_REQUIRE_ESM]...) after creating .env inside /home/upstage/upstage/studio

gloriajw commented 3 months ago

I am not sure what is wrong here, and I don't have time right now to look into it. This installation is going to be difficult. It may not be worth your time. We are eventually going to dockerize it, but that hasn't happened yet.

emrahcom commented 3 months ago

FYI: Adding resolution to package.json looks like fix this error.

  "devDependencies": {
    "@genql/cli": "^6.2.1",
    "@tailwindcss/typography": "^0.5.10",
    "@types/object-hash": "^3.0.6",
    "@vitejs/plugin-vue": "^4.5.2",
    "sass": "^1.26.5",
    "sass-loader": "^8.0.2",
    "typescript": "^5.2.2",
    "vite": "^4.4.9",
    "vite-tsconfig-paths": "^4.2.1",
    "vue-tsc": "^1.8.26"
  },
  "resolutions": { 
    "string-width": "4.2.3"
  } 
}

But now, I have this:

% yarn genql
yarn run v1.22.22
$ genql --endpoint $(grep VITE_GRAPHQL_ENDPOINT .env)studio_graphql/ --output ./src/genql/studio && genql --endpoint $(grep VITE_GRAPHQL_ENDPOINT .env)config_graphql/ --output ./src/genql/config
❯ generating the client in `./src/genql/studio`
  ✖ Failed to parse URL from VITE_GRAPHQL_ENDPOINT=http://localhost/api/studio_graphql/
  ◼ preparing client directory
  ◼ writing files
Cannot generate, got an error:
undefined
error Command failed with exit code 1.

Does it wait for a working graphql at built time? By the way, I'm not waiting for a quick response.

gloriajw commented 3 months ago

Sorry, those instructions need to be updated. Run this: yarn fix_genql_urls instead of running genql We use a custom script for this now.

emrahcom commented 3 months ago

Yes, it works now. The built is completed

gloriajw commented 3 months ago

Fantastic! Thank you.

emrahcom commented 3 months ago

I will start installing services (such as postgres, mqtt) and integrating them with upstage. I want to continue here for the future problems. So, please don't close this issue.

gloriajw commented 3 months ago

It will remain open until you close it.

helenvarley commented 3 months ago

Yes, it works now. The built is completed

that's great to hear! thanks so much for persisting :smiley:

emrahcom commented 3 months ago

For future readers, dashboard was also built after creating .env by cloning .env.localhost

emrahcom commented 2 months ago

As a note: I need to create /home/upstage/uwsgi_sockets and /var/log/uwsgi and set upstage as owner of them to start uwsgi.

As root:

mkdir -p /home/upstage/uwsgi_sockets
mkdir -p /var/log/uwsgi
chown upstage: /home/upstage/uwsgi_sockets
chown upstage: /var/log/uwsgi
emrahcom commented 2 months ago

As note, before starting uwsgi:

cd /home/upstage/upstage/config
cp your_hostname.py $(hostname).py
emrahcom commented 2 months ago

Looks like JWT_SECRET_KEY must be set in somewhere and the correct place for it is /home/upstage/upstage/config/$(hostname).py

emrahcom commented 2 months ago

I have questions related with CIPHER_KEY and SECRET_KEY.

IIUC, I should generate the cipher key like the following:

% cd /home/upstage/upstage/core/auth

% python3 fernet_crypto.py
gAAAAABm1JnXOQq4z0taafajjQS7mhF9h-RKNxSK0LPjdyX1f86PkxdbjHMwedCHSlfWA7PZuufd4-mBtuJIKZidYYMaPig2pw==
Copy-paste this key: b'WHmdmtWq4PzXRdPz1Mk1K83xyaiTRcUcSM9te5j-uzw='

and I should set this value as CIPHER_KEY. According to this example, I think it should be:

CIPHER_KEY = b'WHmdmtWq4PzXRdPz1Mk1K83xyaiTRcUcSM9te5j-uzw='

Is this correct? How should I generate SECRET_KEY?

gloriajw commented 2 months ago

That is correct, and SECRET_KEY can be manually generated with keystrokes.

emrahcom commented 2 months ago

As a note, Mosquitto should support websockets:

/etc/mosquitto/mosquitto.conf

listener 1883
listener 9002
protocol websockets
# for a quick test without authentication
allow_anonymous true

Nginx location block for websockets:

location /mqtt {
    proxy_pass http://127.0.0.1:9002;
    proxy_http_version 1.1;
    proxy_set_header Host $http_host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $remote_addr;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    tcp_nodelay on;
}
emrahcom commented 2 months ago

/stages started working after updating base in /home/upstage/upstage/studio/vite.config.ts:

// base: "/".
base: "./",

And related Nginx block is:

location /stages {
    alias /home/upstage/upstage/studio/dist;
    try_files $uri $uri/ /index.html;
}