self-hosted icon indicating copy to clipboard operation
self-hosted copied to clipboard

Subscription command doesn't work

Open navjotjsingh opened this issue 3 years ago • 4 comments

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.

navjotjsingh avatar Jul 06 '22 02:07 navjotjsingh

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";'
"`

jonwsoto avatar Jul 28 '22 05:07 jonwsoto

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.

koopernick avatar Aug 05 '22 07:08 koopernick

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 :(

mehdiMj-ir avatar Aug 07 '22 20:08 mehdiMj-ir

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.

antonheitz avatar Dec 23 '22 23:12 antonheitz