standardnotes / self-hosted

[Legacy] Self-host your own Standard Notes server for end-to-end encrypted notes and files
https://github.com/standardnotes/server
GNU Affero General Public License v3.0
343 stars 39 forks source link

Subscription command doesn't work #78

Open navjotjsingh opened 2 years ago

navjotjsingh commented 2 years ago

Describe the bug Running the command ./server.sh create-subscription EMAIL@ADDR doesn't work. It gives the following error.

./server.sh: 85: [[: not found

I am using Ubuntu 22.04.

To Reproduce Steps to reproduce the behavior: Run the command ./server.sh create-subscription EMAIL@ADDR

Expected behavior The subscription for the email account should be activated.

Additional context I have realized that the solution is either to run the command as bash ./server.sh create-subscription EMAIL@ADDR or change the first line of the file from #!/bin/sh to #!/bin/bash

This should be explained in the docs or a solution should be implemented that works across all Linux distributions and shells.

jonwsoto commented 1 year ago

you can use phpmyadmin and modify the values yourself here is the two lines from the server.sh that tell you what you need to modify

`$DOCKER_COMPOSE_COMMAND exec db sh -c "MYSQL_PWD=\$MYSQL_ROOT_PASSWORD mysql \$MYSQL_DATABASE -e \ 'INSERT INTO user_roles (role_uuid , user_uuid) VALUES ((SELECT uuid FROM roles WHERE name=\"PRO_USER\" ORDER BY version DESC limit 1) ,(SELECT uuid FROM users WHERE email=\"$EMAIL\")) ON DUPLICATE KEY UPDATE role_uuid = VALUES(role_uuid);' \ "

$DOCKER_COMPOSE_COMMAND exec db sh -c "MYSQL_PWD=\$MYSQL_ROOT_PASSWORD mysql \$MYSQL_DATABASE -e \ 'INSERT INTO user_subscriptions SET uuid=UUID(), plan_name=\"PRO_PLAN\", ends_at=8640000000000000, created_at=0, updated_at=0, user_uuid=(SELECT uuid FROM users WHERE email=\"$EMAIL\"), subscription_id=1, subscription_type=\"regular\";' \ "`

koopernick commented 1 year ago

I have the exact same issue.

Fresh install, and I can't create an user...

Any proper fix coming ?

Edit : the "fix" from the first post doesn't work for me, on Debian 11.

mehdiMj-ir commented 1 year ago

same problem on Ubuntu 22.04, I even manage to get the role_uuid 8047edbb-a10a-4ff8-8d53-c2cae600a8e8 but had problem with user_uuid value :(

antonheitz commented 1 year ago

Hi, (@orifiginal fix) this is because the file uses bash syntax but is declared as shell (which points to bash for some sytems). The Pull request https://github.com/standardnotes/self-hosted/pull/103 fixes this issue and was the reason many people had issues with the file server.

Changing the Shebang will work on all linux systems.