ialbert / biostar-central

Biostar Q&A
http://www.biostars.org/
MIT License
581 stars 231 forks source link

How to deploy the website to a host like Heroku #865

Closed coreydipsy closed 3 years ago

coreydipsy commented 3 years ago

I am trying to deploy the Biostar website(with a little modification but is able to run well on local server) to a host like Heroku. I've checked the documentation for deploying the website, and I've checked the issues on GitHub. These are the few questions I have.

  1. I can't find the deploy.env/deploy.py or staging.env/staging.py in conf
  2. after finishing the task on the documentation, how can I connect it with web server(Heroku)

Thank you!!!

Natay commented 3 years ago

Hey @coreydipsy, we updated the master branch recently and have changed the deployment workflow.

  1. There are no longer deploy.env/deploy.py or staging.env/staging.py in conf. We now use conf/run/site_settings.py and conf/run.site_secrets.py to set settings before preforming any actions.

  2. Our docs on how to deploy to a web server can be found in conf/ansible/README.md. Biostars now uses ansible to automate the deployment process.

There is the unmaintained branch biostar2016, that contains both deploy.env/deploy.py and staging.env/staging.py if you wish to deploy an older version of Biostars.

coreydipsy commented 3 years ago

Thank you for your reply!!! I've found the file. But I don't quite understand some of the lines in conf/ansible/README.md. I tried to follow the step but ran into some errors.Screen Shot 2021-06-12 at 2 43 11 PM

  1. what does it mean to be able to log into the root user of the host , does this mean I have to go apply for a domain name?
  2. When I try to type in thehostnamectl set-hostname www.foo.com and timedatectl set-timezone US/Eastern, it said that:command not found: hostnamect
  3. Do I have to apply for a domain to replace the test.biostars.org in host.ini?

Sorry for bothering you, I am a high school student just started to learn about web development, and there are a lot of things that I don't know, is there any background information that you think I can go learn first?(to make things make more sense and not ask so much stupid questions) Thanks again!!!

Hey @coreydipsy, we updated the master branch recently and have changed the deployment workflow.

  1. There are no longer deploy.env/deploy.py or staging.env/staging.py in conf. We now use conf/run/site_settings.py and conf/run.site_secrets.py to set settings before preforming any actions.
  2. Our docs on how to deploy to a web server can be found in conf/ansible/README.md. Biostars now uses ansible to automate the deployment process.

There is the unmaintained branch biostar2016, that contains both deploy.env/deploy.py and staging.env/staging.py if you wish to deploy an older version of Biostars.

Thank you for your reply!!! I've found the file. But I don't quite understand some of the lines in conf/ansible/README.md. I tried to follow the step but ran into some errors.Screen Shot 2021-06-12 at 2 43 11 PM

  1. what does it mean to be able to log into the root user of the host , does this mean I have to go apply for a domain name?
  2. When I try to type in thehostnamectl set-hostname www.foo.com and timedatectl set-timezone US/Eastern, it said that:command not found: hostnamect
  3. Do I have to apply for a domain to replace the test.biostars.org in host.ini?

Sorry for bothering you, I am a high school student just started to learn about web development, and there are a lot of things that I don't know, is there any background information that you think I can go learn first?(to make things make more sense and not ask so much stupid questions) Thanks again!!!

Natay commented 3 years ago

Hey @coreydipsy, no problem glad to help.

There is a difference between web development and setting up and maintaining web server operations, which I think is what you are trying to do.

The main difference between the two being that Web Devs write the code that DevOps deploy on remote servers.

  1. First get a server address from a cloud platform like : Digial Ocean, AWS, Linode, etcc. Once you get an IP address, login as root using the shell ssh root@your ip address here

    Here are some resources on initial server setups from DigialOcean, they more or less are the same for the others services. https://www.digitalocean.com/community/tutorials/initial-server-setup-with-ubuntu-18-04

  2. hostmanectl is a linux command so it needs to be run on a remote server that is also linux based, if that is the circumstance then there might be something wrong with the installation.

    Here are some resources to help with that: https://askubuntu.com/questions/826466/hostnamectl-command-not-found http://pkgs.loginroot.com/errors/notFound/hostnamectl

  3. We use www.foo.com and test.biostars.org as examples in the docs, you can add your domain into the host.ini file without replacing anything. The only place to replace your domain with test.biostars.org is when running commands.

    The domain in the host.ini can also just be your server (IP) address you got from the cloud platforms in the first step, if you have not applied for a domain name yet.

    Here are some docs on the docs on ansible that detail host setups: https://docs.ansible.com/ansible-core/devel/index.html

    I would suggest setting up things by hand, atleast once, to get a good idea of what is being automated.

Better explanation on DevOps: https://www.guru99.com/devops-tutorial.html

I would approach these things separately, so first step is getting a server from a cloud platform then comes setups and DNS registration.

coreydipsy commented 3 years ago
Screen Shot 2021-06-19 at 9 34 47 PM

In the past few days, I have tried to upload the website using digitaloccean and I followed the tutorial it provided :https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-20-04 I got the same result as the tutorial every step but the last step. When I click on the ip adress I was deploying to, it did not show the website; instead, it said NotFound. Do you have any idea what might cause this? Thank you!!!

RodBelaFarin commented 3 years ago

@coreydipsy did you find a solution for your problem? I would also like to deploy my questions & answers forum to Heroku.

coreydipsy commented 3 years ago

Yep, I did end up finding a solution to deploy the website, but I didn't end up using Heroku. Instead, I used ansible. I followed the tutorial in the biostar/conf/ansible/readme.md.

On Thu, Jul 8, 2021 at 10:23 PM RodBelaFarin @.***> wrote:

@coreydipsy https://github.com/coreydipsy did you find a solution for your problem? I would also like to deploy my questions & answers forum to Heroku.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ialbert/biostar-central/issues/865#issuecomment-876483343, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANLXEBTUENUXMHZICZYTU3DTWWYHHANCNFSM46R3XTTQ .

RodBelaFarin commented 3 years ago

Which host did you use and could you quickly describe the steps you did?

coreydipsy commented 3 years ago

@RodBelaFarin I end up using digitaloccean.

  1. create a droplet on digitaloccean
  2. change the conf/host.ini into the IP address digitaloccean provided
  3. change the makefile repo
  4. change the server of site_nginx.conf
  5. change the server of site_settings.py
  6. cd to the sensible file
  7. type in 'make setup install deploy TARGET=biostar'