aertslab / SCope

Fast visualization tool for large-scale and high dimensional single-cell data
GNU General Public License v3.0
68 stars 15 forks source link

scope-client doesn't start when deploying SCope as aws instance #367

Closed GMaciag closed 4 years ago

GMaciag commented 4 years ago

Hi!

SCope is a great package that I have used on my own computer, however I wanted to set it up to be easily accessed by the rest of my team. I have followed the aws tutorial https://github.com/aertslab/SCope/tree/master/tutorials/aws-deployment-source, but after successfully completing all the steps, I still cannot deploy SCope instance over public internet.

I've installed all the necessary packages in a conda enviroment (output of conda list below) and after running npm run scope-aws I get the following output:

> SCope@1.8.2 scope-aws /home/ec2-user/SCope
> node bin/launch.js --aws

  /$$$$$$   /$$$$$$
 /$$__  $$ /$$__  $$
| $$  \__/| $$  \__/  /$$$$$$   /$$$$$$   /$$$$$$
|  $$$$$$ | $$       /$$__  $$ /$$__  $$ /$$__  $$
 \____  $$| $$      | $$  \ $$| $$  \ $$| $$$$$$$$
 /$$  \ $$| $$    $$| $$  | $$| $$  | $$| $$_____/
|  $$$$$$/|  $$$$$$/|  $$$$$$/| $$$$$$$/|  $$$$$$$
 \______/  \______/  \______/ | $$____/  \_______/
                              | $$
                              | $$
                              |__/

-------- running settings --------
Running on Linux
Running in AWS: true
Running as daemon: true
Running in development mode: true
   *** please run in production mode except if it's for testing purposes.
----------------------------------

--------- sanity checks ----------
poetry command found.
- Checking SCope Server...
scope-server command found.
- Checking SCope poetry environment...
SCope Server is installed and activated!
- Checking tmux...
tmux command found.
- Checking directories (assets)...
- Checking Apache configuration...
Making SCope HTTP Apache web server config file...
Done!
Copying SCope HTTP Apache web server config file apache/scope.conf to /etc/httpd/conf.d
Done!
- Checking public host address...
----------------------------------

--------- running scope ----------
Starting SCope...
Starting SCope Server...
SCope Server started as daemon!
It can be accessed using 'tmux a -t scope-server' command.
Running SCope Client...
SCope Client started as daemon!
It can be accessed using 'tmux a -t scope-client' command.
A SCope instance is running at http://ec2-13-48-97-71.eu-north-1.compute.amazonaws.com
----------------------------------

Next I run the commandsudo systemctl restart httpd, but the address http://ec2-13-48-97-71.eu-north-1.compute.amazonaws.com shows only the test page for apache server (attached below) and not the SCope interface. So it seems my instance and the apache server are properly configured, but there are some issues on the SCope client side? This is also suggested by the fact that running the command tmux a -t scope-client gives me the output session not found: scope-client (tmux a -t scope-server allows me access the server as usual).

I'm not very experienced in networking and so don't really know what to do (or what could be wrong). Could you please help me.

conda list
# packages in environment at /home/ec2-user/miniconda3/envs/scope:
#
# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                        main
appdirs                   1.4.4                    pypi_0    pypi
arboreto                  0.1.5                    pypi_0    pypi
astroid                   2.4.1                    pypi_0    pypi
attrs                     19.3.0                     py_0
black                     19.10b0                  pypi_0    pypi
boltons                   20.1.0                   pypi_0    pypi
brotlipy                  0.7.0           py37h7b6447c_1000
ca-certificates           2020.6.24                     0
cachecontrol              0.12.5                   py37_0
cachy                     0.3.0                      py_0
certifi                   2020.4.5.1               pypi_0    pypi
cffi                      1.14.0           py37he30daa8_1
chardet                   3.0.4                 py37_1003
cleo                      0.7.6                      py_0
click                     7.1.2                    pypi_0    pypi
clikit                    0.4.1                      py_1
cloudpickle               1.4.1                    pypi_0    pypi
coverage                  5.1                      pypi_0    pypi
cryptography              2.9.2            py37h1ba5d50_0
cytoolz                   0.10.1                   pypi_0    pypi
dask                      1.0.0                    pypi_0    pypi
dbus                      1.13.16              hb2f20db_0
decorator                 4.4.2                    pypi_0    pypi
dill                      0.3.1.1                  pypi_0    pypi
distributed               1.28.1                   pypi_0    pypi
dparse                    0.5.1                    pypi_0    pypi
entrypoints               0.3                      py37_0
expat                     2.2.9                he6710b0_2
fastapi                   0.54.1                   pypi_0    pypi
frozendict                1.2                      pypi_0    pypi
glib                      2.65.0               h3eb4bd4_0
grpcio                    1.29.0                   pypi_0    pypi
grpcio-testing            1.30.0                   pypi_0    pypi
grpcio-tools              1.29.0                   pypi_0    pypi
h11                       0.9.0                    pypi_0    pypi
h2                        3.2.0                    pypi_0    pypi
h5py                      2.10.0                   pypi_0    pypi
heapdict                  1.0.1                    pypi_0    pypi
hpack                     3.0.0                    pypi_0    pypi
html5lib                  1.1                        py_0
hypercorn                 0.9.5                    pypi_0    pypi
hyperframe                5.2.0                    pypi_0    pypi
hypothesis                5.14.0                   pypi_0    pypi
idna                      2.9                      pypi_0    pypi
importlib-metadata        1.6.0                    pypi_0    pypi
inspect2                  0.1.2                    pypi_0    pypi
interlap                  0.2.6                    pypi_0    pypi
isort                     4.3.21                   pypi_0    pypi
jeepney                   0.4.3                      py_0
joblib                    0.15.0                   pypi_0    pypi
jsonschema                3.2.0                    py37_0
keyring                   19.2.0                   py37_0
lazy-object-proxy         1.4.3                    pypi_0    pypi
ld_impl_linux-64          2.33.1               h53a641e_7
libedit                   3.1.20191231         h7b6447c_0
libffi                    3.3                  he6710b0_1
libgcc-ng                 9.1.0                hdf63c60_0
libstdcxx-ng              9.1.0                hdf63c60_0
llvmlite                  0.32.1                   pypi_0    pypi
lockfile                  0.12.2                   py37_0
loompy                    3.0.6                    pypi_0    pypi
mccabe                    0.6.1                    pypi_0    pypi
methodtools               0.1.2                    pypi_0    pypi
more-itertools            8.2.0                    pypi_0    pypi
msgpack-python            1.0.0            py37hfd86e86_1
multiprocessing-on-dill   3.5.0a4                  pypi_0    pypi
mypy                      0.770                    pypi_0    pypi
mypy-extensions           0.4.3                    pypi_0    pypi
mypy-protobuf             1.20                     pypi_0    pypi
ncurses                   6.2                  he6710b0_1
networkx                  2.4                      pypi_0    pypi
numba                     0.49.1                   pypi_0    pypi
numpy                     1.18.4                   pypi_0    pypi
numpy-groupies            0+unknown                pypi_0    pypi
openssl                   1.1.1g               h7b6447c_0
packaging                 20.3                     pypi_0    pypi
pandas                    1.0.3                    pypi_0    pypi
pastel                    0.1.0                      py_1
pathspec                  0.8.0                    pypi_0    pypi
pcre                      8.44                 he6710b0_0
pexpect                   4.8.0                    py37_0
pip                       20.1.1                   py37_1
pkginfo                   1.5.0.1                  py37_0
pluggy                    0.13.1                   pypi_0    pypi
poetry                    1.0.2                    py37_0
priority                  1.3.0                    pypi_0    pypi
protobuf                  3.11.3                   pypi_0    pypi
psutil                    5.7.0                    pypi_0    pypi
ptyprocess                0.6.0                    py37_0
py                        1.8.1                    pypi_0    pypi
pyarrow                   0.16.0                   pypi_0    pypi
pycparser                 2.20                       py_0
pydantic                  1.5.1                    pypi_0    pypi
pylev                     1.3.0                      py_0
pylint                    2.5.2                    pypi_0    pypi
pylint-fail-under         0.3.0                    pypi_0    pypi
pyopenssl                 19.1.0                   py37_0
pyparsing                 2.4.7                      py_0
pyrsistent                0.14.11          py37h7b6447c_0
pyscenic                  0.9.19                   pypi_0    pypi
pysocks                   1.7.1                    py37_0
pytest                    5.4.2                    pypi_0    pypi
pytest-cov                2.8.1                    pypi_0    pypi
python                    3.7.7                hcff3b4d_5
python-dateutil           2.8.1                    pypi_0    pypi
pytz                      2020.1                   pypi_0    pypi
pyyaml                    5.3.1                    pypi_0    pypi
readline                  8.0                  h7b6447c_0
regex                     2020.5.14                pypi_0    pypi
requests                  2.23.0                   pypi_0    pypi
requests-toolbelt         0.8.0                    py37_0
safety                    1.9.0                    pypi_0    pypi
scikit-learn              0.23.0                   pypi_0    pypi
scipy                     1.4.1                    pypi_0    pypi
scope-server              1.8.1                     dev_0    <develop>
secretstorage             3.1.2                    py37_0
setuptools                47.3.1                   py37_0
shellingham               1.3.1                      py_0
singledispatch            3.4.0.3                  pypi_0    pypi
six                       1.14.0                   pypi_0    pypi
sortedcontainers          2.1.0                    pypi_0    pypi
sqlite                    3.32.3               h62c20be_0
starlette                 0.13.2                   pypi_0    pypi
tbb                       2020.0.133               pypi_0    pypi
tblib                     1.6.0                    pypi_0    pypi
threadpoolctl             2.0.0                    pypi_0    pypi
tk                        8.6.10               hbc83047_0
toml                      0.10.1                   pypi_0    pypi
tomlkit                   0.5.8                    py37_0
toolz                     0.10.0                   pypi_0    pypi
tornado                   6.0.4                    pypi_0    pypi
tqdm                      4.46.0                   pypi_0    pypi
typed-ast                 1.4.1                    pypi_0    pypi
typing-extensions         3.7.4.2                  pypi_0    pypi
umap-learn                0.4.3                    pypi_0    pypi
urllib3                   1.25.9                     py_0
wcwidth                   0.1.9                    pypi_0    pypi
webencodings              0.5.1                    py37_1
wheel                     0.34.2                   py37_0
wirerope                  0.3.1                    pypi_0    pypi
wrapt                     1.12.1                   pypi_0    pypi
wsproto                   0.15.0                   pypi_0    pypi
xz                        5.2.5                h7b6447c_0
zict                      2.0.0                    pypi_0    pypi
zipp                      3.1.0                      py_0
zlib                      1.2.11               h7b6447c_3
Screenshot 2020-07-02 at 10 57 07
dweemx commented 4 years ago

Hi @GMaciag,

We are happy to hear that SCope useful for your research. SCope is currently under active development. So, it's possible that we broke something to deploy SCope on AWS. I'm going to look into this and will keep you in touch as soon as possible

GMaciag commented 4 years ago

Hi @dweemx

Thank you for a prompt reply. It would be really great to have SCope deployed on AWS, so I appreciate you looking into this. Please let me know if I can assist you in figuring out the issue.

dweemx commented 4 years ago

Hi @GMaciag,

Good news, I could reproduce the problem you are experiencing. The tutorial is indeed outdated and some fixes are required to make SCope work on AWS.

I've made a branch fixes_for_aws_deployment with fixes (code fixes and tutorial update) that solve the issue

Could you give it a try and let me know if it works for you ?

GMaciag commented 4 years ago

Hi again

Unfortunately, it still doesn't work for me :(

I made an entirely new aws instance (from scratch, following the tutorial). I followed the new tutorial https://github.com/aertslab/SCope/blob/fixes_for_aws_deployment/docs/aws-deployment-source/README.md , while paying attention to download the fixed version of the package with git clone https://github.com/aertslab/SCope.git --branch fixes_for_aws_deployment. I confirmed that bin/launch.js file has been changed (as I saw from the commits that's the only code fix that has been applied). Now when running npm run scope-dev-aws (or npm run scope-aws, doesn't matter), I get the following output:

(base) [ec2-user@ip-172-31-13-26 SCope]$ npm run scope-dev-aws

> SCope@1.8.2 scope-dev-aws /home/ec2-user/SCope
> node bin/launch.js --dev --aws

  /$$$$$$   /$$$$$$
 /$$__  $$ /$$__  $$
| $$  \__/| $$  \__/  /$$$$$$   /$$$$$$   /$$$$$$
|  $$$$$$ | $$       /$$__  $$ /$$__  $$ /$$__  $$
 \____  $$| $$      | $$  \ $$| $$  \ $$| $$$$$$$$
 /$$  \ $$| $$    $$| $$  | $$| $$  | $$| $$_____/
|  $$$$$$/|  $$$$$$/|  $$$$$$/| $$$$$$$/|  $$$$$$$
 \______/  \______/  \______/ | $$____/  \_______/
                              | $$
                              | $$
                              |__/

-------- running settings --------
Running on Linux
Running in AWS: true
Running as daemon: true
Running in development mode: true
   *** please run in production mode except if it's for testing purposes.
----------------------------------

--------- sanity checks ----------
poetry command found.
- Checking SCope Server...
scope-server cannot be found.
- Checking SCope poetry environment...
- Checking tmux...
tmux command found.
- Checking directories (assets)...
- Checking Apache configuration...
Making SCope HTTP Apache web server config file...
Done!
Copying SCope HTTP Apache web server config file apache/scope.conf to /etc/httpd/conf.d
Done!
- Checking public host address...
----------------------------------

--------- running scope ----------
Starting SCope...
Starting SCope Server...
SCope Server started as daemon!
It can be accessed using 'tmux a -t scope-server' command.
Running SCope Client...
SCope Client started as daemon!
It can be accessed using 'tmux a -t scope-client' command.
A SCope instance is running at http://ec2-13-48-97-71.eu-north-1.compute.amazonaws.com
----------------------------------

Unlike previously it now throws:

- Checking SCope Server...
scope-server cannot be found.

Despite that, the command 'tmux a -t scope-server' gives (same as before):

2020-07-07 11:23:58,557 - scopeserver - INFO -
  /$$$$$$   /$$$$$$                                       /$$$$$$
 /$$__  $$ /$$__  $$                                     /$$__  $$
| $$  \__/| $$  \__/  /$$$$$$   /$$$$$$   /$$$$$$       | $$  \__/  /$$$$$$   /$$$$$$  /$$    /$$ /$$$$$$   /$$$$$$
|  $$$$$$ | $$       /$$__  $$ /$$__  $$ /$$__  $$      |  $$$$$$  /$$__  $$ /$$__  $$|  $$  /$$//$$__  $$ /$$__  $$
 \____  $$| $$      | $$  \ $$| $$  \ $$| $$$$$$$$       \____  $$| $$$$$$$$| $$  \__/ \  $$/$$/| $$$$$$$$| $$  \__/
 /$$  \ $$| $$    $$| $$  | $$| $$  | $$| $$_____/       /$$  \ $$| $$_____/| $$        \  $$$/ | $$_____/| $$
|  $$$$$$/|  $$$$$$/|  $$$$$$/| $$$$$$$/|  $$$$$$$      |  $$$$$$/|  $$$$$$$| $$         \  $/  |  $$$$$$$| $$
 \______/  \______/  \______/ | $$____/  \_______/       \______/  \_______/|__/          \_/    \_______/|__/
                              | $$
                              | $$
                              |__/

2020-07-07 11:23:58,557 - scopeserver - DEBUG - Starting data server on port 55853. app_mode: False
2020-07-07 11:23:58,558 - scopeserver - DEBUG - Starting upload server on port 55851
2020-07-07 11:23:58,570 - scopeserver - DEBUG - Starting bind server on port 55852
Running on 127.0.0.1:8000 over http (CTRL + C to quit)
{"msg": {"origin": "PServer", "value": "SIGSTART"}}
2020-07-07 11:23:59,105 - scopeserver.dataserver.utils.data_file_handler - DEBUG - Building UUID "database"
2020-07-07 11:23:59,110 - scopeserver.dataserver.utils.data_file_handler - DEBUG - Existing User UUIDs:
2020-07-07 11:23:59,111 - scopeserver.dataserver.utils.data_file_handler - DEBUG - Existing Permanent Sessions:"
2020-07-07 11:23:59,111 - scopeserver.dataserver.utils.data_file_handler - DEBUG -      UUID SCopeApp__2240e768-5063-4940-a048-8951c639eb7c, mode rw. Valid until 2021-07-07 11:23:59
2020-07-07 11:23:59,111 - scopeserver.dataserver.utils.data_file_handler - DEBUG - Building UUID "database"
{"msg": {"origin": "GServer", "value": "SIGSTART"}}

The command 'tmux a -t scope-client' again gives session not found: scope-client.

Trying to connect to the webpage gives me 'service unavailable' error.

image

dweemx commented 4 years ago

Hi @GMaciag ,

Unfortunately, I cannot reproduce the error you get. In my case the client and server are starting and I can access SCope on the AWS server.

Maybe some stuff to take into consideration:

Here the complete commands I run until having SCope running and being accessible in the browser.

sudo yum update -y
sudo yum install -y httpd
sudo usermod -a -G apache ec2-user
exit
ssh aws-scope
sudo chown -R ec2-user:apache /var/www
sudo chown -R ec2-user:apache /etc/httpd/conf.d
sudo chmod 2775 /var/www && find /var/www -type d -exec sudo chmod 2775 {} \;
sudo chmod 2775 /etc/httpd/conf.d
find /var/www -type f -exec sudo chmod 0664 {} \;
IS_ENABLED=$(sudo systemctl is-enabled httpd)
if [ "${IS_ENABLED}" = "enabled" ]; then
    echo "Apache Web Server is enabled"
else
    # If not enabled start
    echo "Apache Web Server is disabled. Starting Apache Web Server..."
    sudo systemctl start httpd && sudo systemctl enable httpd
fi
sudo systemctl is-enabled httpd
sudo systemctl enable httpd

sudo yum install -y git
curl --silent --location https://rpm.nodesource.com/setup_10.x | sudo bash -
sudo yum install -y nodejs
sudo yum groupinstall -y "Development tools"
sudo yum install -y tmux

wget --content-disposition http://bit.ly/miniconda3
bash Miniconda3-latest-Linux-x86_64.sh
bash

pip install poetry
git clone https://github.com/aertslab/SCope.git
cd SCope
git checkout fixes_for_aws_deployment
npm install

# Here you need to update the publicHostAddress enapache/config.json file by updating the value of publicHostAddress

npm run scope-dev-aws
sudo systemctl restart httpd

The tutorial is updated with all the considerations aforementioned.

GMaciag commented 4 years ago

When it comes to the type of instance, I'm using micro since it's included in the free account on aws. I don't want to pay for a small instance, especially I don't know it will work in the end. Also I'm using t3 instances since that's what is offered by aws now (and not t2). I'm not sure if that makes any difference.

I followed the commands you posted step by step. This time I didn't get the

- Checking SCope Server...
scope-server cannot be found.

but still at the end the client doesn't start the webaddress returns the "Service Unavailable" page.

I apologise for not being able to provide more details on my issue, I haven't worked with aws before, I don't know what could be wrong.

dweemx commented 4 years ago

Ok, good to know you're working t3.micro. I'll give it a try and hope being able to reproduce the problem

dweemx commented 4 years ago

@GMaciag , Are you sure you pulled (git pull) the latest changes from the branch ? because the following message:

- Checking SCope Server...
scope-server cannot be found.

should not appear

I tried on t3.micro, here is my console after running npm run scope-dev-aws (:

> SCope@1.8.2 scope-dev-aws /home/ec2-user/SCope
> node bin/launch.js --dev --aws

  /$$$$$$   /$$$$$$                               
 /$$__  $$ /$$__  $$                              
| $$  \__/| $$  \__/  /$$$$$$   /$$$$$$   /$$$$$$ 
|  $$$$$$ | $$       /$$__  $$ /$$__  $$ /$$__  $$
 \____  $$| $$      | $$  \ $$| $$  \ $$| $$$$$$$$
 /$$  \ $$| $$    $$| $$  | $$| $$  | $$| $$_____/
|  $$$$$$/|  $$$$$$/|  $$$$$$/| $$$$$$$/|  $$$$$$$
 \______/  \______/  \______/ | $$____/  \_______/
                              | $$                
                              | $$                
                              |__/                

-------- running settings --------
Running on Linux
Running in AWS: true
Running as daemon: true
Running in development mode: true
   *** please run in production mode except if it's for testing purposes.
----------------------------------

--------- sanity checks ----------
poetry command found.
- Checking SCope poetry environment...
- Checking tmux...
tmux command found.
- Checking directories (assets)...
- Checking Apache configuration...
Making SCope HTTP Apache web server config file...
Done!
Copying SCope HTTP Apache web server config file apache/scope.conf to /etc/httpd/conf.d
Done!
- Checking public host address...
----------------------------------

--------- running scope ----------
Starting SCope...
Running SCope Client...
SCope Client started as daemon!
It can be accessed using 'tmux a -t scope-client' command.
Starting SCope Server...
SCope Server started as daemon!
It can be accessed using 'tmux a -t scope-server' command.
A SCope instance is running at http://ec2-XXX-XXX-XXX-XXX.eu-west-3.compute.amazonaws.com

The log is not entirely correct:

One thing you could try if you really want to test on a micro instance is build the JavaScript file on your local computer and then rsync it to the AWS server:

  1. npm run build-aws
  2. rsync the index.html file and the assets folder to the AWS instance
  3. On the AWS instance, from the SCope repo: cp -rf . /var/www/html/
  4. sudo systemctl restart httpd

I tried it my self but having problems (don't know exactly why yet):

image

GMaciag commented 4 years ago

Hi @dweemx

Yes, you are correct. After I have pulled the correct branch (following your instructions), I do not get the:

- Checking SCope Server...
scope-server cannot be found.

message anymore.

It's good to know where the problem lies. I think we can close the issue, since the requirement for launching a t2.small instance is now mentioned right in the tutorial.

I'll look into the possibility of running a small instance in the future, for now I'll focus on alternative solutions. Thank you very much for your help with solving the issue.

dweemx commented 4 years ago

Thanks for your bug report. We will try in the future to smoothen the deployment