Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[INSTALL.MD][HELP NEEDED] #295

Open
fcarvalhopacheco opened this issue Dec 30, 2020 · 9 comments
Open

[INSTALL.MD][HELP NEEDED] #295

fcarvalhopacheco opened this issue Dec 30, 2020 · 9 comments

Comments

@fcarvalhopacheco
Copy link

fcarvalhopacheco commented Dec 30, 2020

Hi all.

Sorry for the lack of knowledge but I'm trying to create a step-by-step installation guide to help me and maybe other users to install the software. The installation roadmap is still unclear to me. However, I think I am really close to run the software

Please see my guide below and let me know if you can help me. That would be much appreciated.

INSTALL.MD guide for Roundabout DB Application

  1. Install Docker
  • Follow instructions here

  • Check if docker and docker-compose are installed, by typing the following in your terminal

$docker -v
$docker-compose -v
  1. Fork this repository to you github account

  2. Clone your forked repository to your local machine by typing:

# This is from my account. change fcarvalhopacheco to your own account
$ git clone [email protected]:fcarvalhopacheco/ooicgsn-roundabout.git
  1. Check all the remote repositories
cd ooicgsn-roundabout
git remote -v
  1. Keep your forked repository up-to-date with the up-stream MAIN repository. On Github, navigate back to the main repository project menu. Copy the original SSH link (something like [email protected]:main_repository_that_your_forked_from/forked_repository.git). Go back to terminal and type the following:
$ git remote add upstream [email protected]:WHOIGit/ooicgsn-roundabout.git
  1. Get information from the upstream (WHOIGit/ooicgsn-roundabout.git repository)
$ git fetch upstream
  1. Currently, your local copy of the master branch is pointing to your personal remote forked repository. Your remote repository is called origin. You want your local copy of master to point up-stream (=to the person's repository not yours), so whatever you pull changes into master, it will get the latest changes from the up-stream repository .
$ git branch --set-upstream-to=upstream/master master

you should see Branch 'master' set up to track remote branch 'master' from 'upstream'.

  1. Create a new branch
# Change hot-inventory with your own name
git checkout -b 'hot-inventory'
  1. Make your changes, commit ,and push to YOUR forkerd repository
 git add xxxxxxx(file that was modified)
 git commit -S -am 'changes on file xxxxx'
 git push origin hot-inventory # Change hot-inventory with your own name
  1. Config your .envs folder
  • Change folder name
$ mv .envs.example .envs

Ps. .envs is already inside .gitignore!

  • Navigate and open the following
 # Change hot-inventory to the name you created before
cd hot-inventory/ooicgsn-roundabout/.envs/.local
vi .django
  • Change the following
DJANGO_SU_NAME= addyourownnamehere
DJANGO_SU_EMAIL=addyourownemailhere
DJANGO_SU_PASSWORD=addyourownpasswordhere
  • Open the following:
vi .postgres
  • Change the following
POSTGRES_HOST=postgres       # This default is fine.  POSTGRES_HOST: The container running Postgres. This variable
                              # should be changed to the Postgres container name. In our case, the default value is
                              # "postgres". The default container name can be changed from the Docker-Compose file
                              # (local.yml) found in the root project directory.
  
POSTGRES_PORT=543            # This default is fine. POSTGRES_PORT: 5432 is the default port for Postgres. This port
                               # number is defined for the "postgres" service within the Docker-Compose file
                               # (root/local.yml).
  
POSTGRES_DB=roundabout       # This default is fine. Default database name. "roundabout" is the default here. This
                               # variable will configure the database name within the Postgres container.

POSTGRES_USER=addyourownnamehere
POSTGRES_PASSWORD=addyourownpasswordhere
  • Do the same for .production folder
# Change hot-inventory to the name you created before
cd hot-inventory/ooicgsn-roundabout/.envs/.production
vi .django

# Change the following
DJANGO_SU_NAME= addyourownnamehere
DJANGO_SU_EMAIL=addyourownemailhere
DJANGO_SU_PASSWORD=addyourownpasswordhere

# Open the file :
vi .postgres

# Change the following
POSTGRES_HOST=postgres        # (This default is fine)
POSTGRES_PORT=543                # (This default is fine)
POSTGRES_DB=roundabout        # (This default is fine)
POSTGRES_USER=addyourownnamehere
POSTGRES_PASSWORD=addyourownpasswordhere
  1. Config your .ssl file

HOW DO I DO THIS ???

for now :

If you're not using SSL (you should really use SSL), comment out the following line in the production.yml file and update the NGINX conf file accordingly:

volumes:
  - ./.ssl/certs:/etc/ssl/certs/ # bind a local directory with the SSL certs
  1. Config NGINX

HOW DO I DO THIS??? I know that there is an example file but what are the exact steps to be done in order to make roundabout work?

  # Navigate to the nginx folder (*change hot-inventory*)
  $ cd hot-inventory/ooicgsn-roundabout/compose/production/nginx
  
 # rename the file
  $ mv nginx-example.conf.EXAMPLE nginx.conf
  1. Build the production.yml
$ cd ~/hot-inventory/ooicgsn-roundabout/ 
$ docker-compose -f production.yml build

# You should see something like:
Successfully built 4f58bca3e0f9
Successfully tagged roundabout_production_nginx:latest
  1. Now deploy it
docker-compose -f production.yml up -d

# You should see something like:
Creating network "roundabout-network" with driver "bridge"
Creating volume "ooicgsn-roundabout_production_postgres_data" with default driver
Creating volume "ooicgsn-roundabout_production_postgres_data_backups" with default driver
Creating volume "ooicgsn-roundabout_production_nginx" with default driver
Creating volume "ooicgsn-roundabout_static_volume" with default driver
Creating volume "ooicgsn-roundabout_media_volume" with default driver
Pulling redis (redis:6.0)...
6.0: Pulling from library/redis
6ec7b7d162b2: Pull complete
1f81a70aa4c8: Pull complete
968aa38ff012: Pull complete
884c313d5b0b: Pull complete
6e858785fea5: Pull complete
78bcc34f027b: Pull complete
Digest: sha256:0f724af268d0d3f5fb1d6b33fc22127ba5cbca2d58523b286ed3122db0dc5381
Status: Downloaded newer image for redis:6.0
Creating ooicgsn-roundabout_redis_1 ... done
Creating postgres                   ... done
Creating ooicgsn-roundabout_flower_1       ... done
Creating ooicgsn-roundabout_celeryworker_1 ... done
Creating ooicgsn-roundabout_django_1       ... done
Creating ooicgsn-roundabout_celerybeat_1   ... done
Creating nginx                             ... done

Also please see my docker running :

Screen Shot 2020-12-30 at 09 17 46

@fcarvalhopacheco fcarvalhopacheco changed the title [INSTALL.MD][HELP] [INSTALL.MD][HELP NEEDED] Dec 30, 2020
@MarioCarloni
Copy link
Collaborator

MarioCarloni commented Jan 8, 2021

Hi Fernando,

I can help you at least with clearing up the local Postgres/Docker portion of your environment variables documentation, and perhaps others may jump in to assist:

POSTGRES_HOST: The container running Postgres. This variable should be changed to the Postgres container name. In our case, the default value is "postgres". The default container name can be changed from the Docker-Compose file (local.yml) found in the root project directory.

POSTGRES_PORT: 5432 is the default port for Postgres. This port number is defined for the "postgres" service within the Docker-Compose file (root/local.yml).

POSTGRES_DB: Default database name. "roundabout" is the default here. This variable will configure the database name within the Postgres container.

@fcarvalhopacheco
Copy link
Author

fcarvalhopacheco commented Jan 9, 2021

Hi @MarioCarloni

Thanks for the reply. So basically, I am guessing those default values don't need to be modified and they should work fine...

What do you think about having this file available (install.md or contributing.md)? Do you think that would be useful for people?

Let me know because then I can improve the file with people's help and perhaps make a pull request?

Cheers

@MarioCarloni
Copy link
Collaborator

Hey Fernando,

Yeah exactly, you can, but don't have to, modify the default environment values while working locally.

Including links to install and contributing markdown files in the readme might be useful!

Cheers,

Mario

@fcarvalhopacheco
Copy link
Author

fcarvalhopacheco commented Sep 20, 2021

Hi Mario and all

Hope all is well with you. I am still trying to install this software. I tried everything again using an ubuntu machine this time.

Could you tell me what is the container name from DOCKER COMPOSE file that I should use on my own `/etc/ngix/sites-available/…… file?

I ran sudo docker container ls to see my containers and this is what I have:

Screen Shot 2021-09-19 at 20 38 10

This is what I am trying to resolve on my Nginx:
proxy_pass http://django:8000; # <- Use container name from DOCKER COMPOSE file
proxy_pass http://alfresco:8080; # <- Use container name from DOCKER COMPOSE file
proxy_pass http://alfresco-share:8080; # <- Use container name from DOCKER COMPOSE file
proxy_pass http://alfresco-solr6:8983; # <- Use container name from DOCKER COMPOSE file

Cheers
Fernando

@MarioCarloni
Copy link
Collaborator

Hey Fernando,

Since the nginx.conf contains proxy_pass references to the front-end already, your default sites-available file shouldn't need to contain reference to any specific container. If your nginx container is running on port 80, then any request to localhost, or the public IP of the running VM, from a web browser should resolve to the front-end container. An error should populate in the console or in the window otherwise. I may be misunderstanding your question as well, so let me know of any details I may have missed!

Cheers,

Mario

@fcarvalhopacheco
Copy link
Author

fcarvalhopacheco commented Sep 21, 2021

Hi @MarioCarloni

Just for your reference, this is what I have so far:

I was able to active nginx , see below

on my /etc/nginx/sites-available/hot-roundabout.com file with symbolic link on /etc/nginx/sites-enabled/hot-roundabout.com
and on ~/ooicgsn-roundabout/nginx/hot-roundabout.com

#Redirect all non-encrypted to encrypted

server {
    listen 80;

    server_name localhost;

    return 301 https://hot-roundabout.com.com$request_uri;
    }

# now we declare our https main server

server {
     server_name hot-roundabout.com;

     listen 443  ssl;  # <-

    #ssl on;  # <-
     ssl_certificate myownpathto/.ssl/hot-roundaboutcom.crt ;  # <-
     ssl_certificate_key myownpathto.ssl/hot-roundabout.com.key;  # <-

     client_max_body_size 0M;

     proxy_pass_request_headers on;
     proxy_pass_header Set-Cookie;

     # Main Django application
     location / {
         proxy_set_header X-Real-IP $remote_addr;
         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
         proxy_set_header X-Forwarded-Proto https;
         proxy_set_header Host $http_host;
         proxy_redirect off;
         proxy_read_timeout 300;
         proxy_send_timeout 90;
         proxy_connect_timeout 90;

         if (!-f $request_filename) {
             proxy_pass http://hot-roundabout.com:8000; # <- Use container name from DOCKER COMPOSE file
             break;
         }
     }

     # Alfresco Community Edition location blocks
     location /alfresco/ {
         proxy_pass http://hot-roundabout.com:8080; # <- Use container name from DOCKER COMPOSE file
         proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
         proxy_redirect off;
         proxy_buffering off;
         proxy_set_header Host            $host;
         proxy_set_header X-Real-IP       $remote_addr;
         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
         proxy_pass_header Set-Cookie;
     }

     # Alfresco Share Web App
     location /share/ {
         proxy_pass http://alfresco-share:8080; # <- Use container name from DOCKER COMPOSE file
         proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
         proxy_redirect off;
         proxy_buffering off;
         proxy_set_header Host            $host;
         proxy_set_header X-Real-IP       $remote_addr;
         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
         proxy_pass_header Set-Cookie;
     }


     # SOLR Web Console
     location /solr/ {
         proxy_pass http://hot-roundabout.com:8983; # <- Use container name from DOCKER COMPOSE file
         proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
         proxy_redirect off;
         proxy_buffering off;
         proxy_set_header Host            $host;
         proxy_set_header X-Real-IP       $remote_addr;
         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
         proxy_pass_header Set-Cookie;
     }

 }
nginx.service - A high performance web server and a reverse proxy server
     Loaded: loaded (/lib/systemd/system/nginx.service; disabled; vendor preset: enabled)
     Active: active (running) since Tue 2021-09-21 17:55:04 HST; 4min 37s ago
       Docs: man:nginx(8)
    Process: 791899 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code>
    Process: 791900 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, >
   Main PID: 791901 (nginx)
      Tasks: 9 (limit: 9344)
     Memory: 7.6M
     CGroup: /system.slice/nginx.service
             ├─791901 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
             ├─791902 nginx: worker process
             ├─791903 nginx: worker process
             ├─791904 nginx: worker process
             ├─791905 nginx: worker process
             ├─791906 nginx: worker process
             ├─791907 nginx: worker process
             ├─791908 nginx: worker process
             └─791909 nginx: worker process

docker is also up and running docker-compose -f local.yml up -d

ooicgsn-roundabout_postgres_1 is up-to-date
ooicgsn-roundabout_redis_1 is up-to-date
Starting ooicgsn-roundabout_django_1       ... done
Starting ooicgsn-roundabout_flower_1       ... done
Starting ooicgsn-roundabout_celeryworker_1 ... done
Starting ooicgsn-roundabout_celerybeat_1   ... done

I can access the default localhost:8080 webpage but not hot-roundabout.com or www.hot-roundabout.com. By the way, my /var/www/ has /var/www/html' and /var/www/hot-roundabout`. the first one is the nginx default display and the second folder was just a test...

my firewall is allowing 80/tcp; 443/tcp; Ngix Full 80/tcp (v6); 443/tcp(v6); Ngix Full (v6)

I also tried to restart docker with a link of my /etc/nginx folders and fikes to ~/ooicgsn-roundabout/nginx folder, without success.

this is my /etc/hosts/ , xxx.xxx.xxx is my ip.

127.0.0.1	localhost
xxx.xxx.xxx hot-roundabout.com

I also tried `127.0.0.1 localhost hot-roundabout.com'

please see my ooicgsn-roundabout folder:
Screen Shot 2021-09-22 at 19 23 19

@fcarvalhopacheco
Copy link
Author

fcarvalhopacheco commented Sep 23, 2021

Hi Mario,

I can't believe it but I was running docker-compose -f local.yml up -d instead of docker-compose-prod.yml up -d ...

That explains so many things but I am still having issues with that proxy_pass configuration.

● nginx.service - A high performance web server and a reverse proxy server
     Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Wed 2021-09-22 21:37:34 HST; 1s ago
       Docs: man:nginx(8)
    Process: 1655814 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FAILURE)

Sep 22 21:37:33 xubuntu-server systemd[1]: Starting A high performance web server and a reverse proxy server...
Sep 22 21:37:34 xubuntu-server nginx[1655814]: nginx: [emerg] host not found in upstream "django" in /etc/nginx/sites-enabled/nginx.conf:34
Sep 22 21:37:34 xubuntu-server nginx[1655814]: nginx: configuration file /etc/nginx/nginx.conf test failed
Sep 22 21:37:34 xubuntu-server systemd[1]: nginx.service: Control process exited, code=exited, status=1/FAILURE
Sep 22 21:37:34 xubuntu-server systemd[1]: nginx.service: Failed with result 'exit-code'.
Sep 22 21:37:34 xubuntu-server systemd[1]: Failed to start A high performance web server and a reverse proxy server.

@MarioCarloni
Copy link
Collaborator

Hey @fcarvalhopacheco I think you're really close. It looks like the error is referencing an nginx.conf file located at /sites-available. I believe that conf file should live at /etc/nginx/. Try moving it there then restarting the nginx service.

@fcarvalhopacheco
Copy link
Author

fcarvalhopacheco commented Sep 26, 2021

HI Mario,

Thanks for the answer.

I am still lost with this ooicgsn-roundabout nginx.conf.template . This is very different from what other tutorials recommend to use on /etc/nginx/nginx.conf. Please see here https://www.nginx.com/resources/wiki/start/topics/examples/full/ or here
http://nginx.org/en/docs/example.html

See the error that I am getting using the ooicgsn-roundabout nginx.conf.template in the folder /etc/nginx . It doesn't even like the server{ .... } on it that starts on line 2?

● nginx.service - A high performance web server and a reverse proxy server
     Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Sat 2021-09-25 19:07:10 HST; 6s ago
       Docs: man:nginx(8)
    Process: 2264048 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FAILURE)

Sep 25 19:07:10 xubuntu-server systemd[1]: Starting A high performance web server and a reverse proxy server...
Sep 25 19:07:10 xubuntu-server nginx[2264048]: nginx: [emerg] "server" directive is not allowed here in /etc/nginx/nginx.conf:3
Sep 25 19:07:10 xubuntu-server nginx[2264048]: nginx: configuration file /etc/nginx/nginx.conf test failed
Sep 25 19:07:10 xubuntu-server systemd[1]: nginx.service: Control process exited, code=exited, status=1/FAILURE
Sep 25 19:07:10 xubuntu-server systemd[1]: nginx.service: Failed with result 'exit-code'.
Sep 25 19:07:10 xubuntu-server systemd[1]: Failed to start A high performance web server and a reverse proxy server.

I tried to combine both files, your template and the default from nginx but the errors always come back to the proxy_pass!

user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;

events {
	worker_connections 768;
	# multi_accept on;
}

http {

	##
	# Basic Settings
	##

	sendfile on;
	tcp_nopush on;
	tcp_nodelay on;
	keepalive_timeout 65;
	types_hash_max_size 2048;
	# server_tokens off;

	# server_names_hash_bucket_size 64;
	# server_name_in_redirect off;

	include /etc/nginx/mime.types;
	default_type application/octet-stream;

	##
	# SSL Settings
	##

	ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE
	ssl_prefer_server_ciphers on;

	##
	# Logging Settings
	##

	access_log /var/log/nginx/access.log;
	error_log /var/log/nginx/error.log;

	##
	# Gzip Settings
	##

	gzip on;

	# gzip_vary on;
	# gzip_proxied any;
	# gzip_comp_level 6;
	# gzip_buffers 16 8k;
	# gzip_http_version 1.1;
	# gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;

	##
	# Virtual Host Configs
	##

	include /etc/nginx/conf.d/*.conf;
	include /etc/nginx/sites-enabled/*;

# Redirect all non-encrypted to encrypted
server {
    server_name 127.0.0.1;
    listen 80;
    return 301 https://127.0.0.1$request_uri;
}

# now we declare our https main server

server {
    server_name 127.0.0.1;

    listen 443 ssl;  # <-

    ssl_certificate /etc/secure/hot-roundabout.crt;  # <-
    ssl_certificate_key /etc/secure/hot-roundabout.key;  # <-

    client_max_body_size 0M;

    proxy_pass_request_headers on;
    proxy_pass_header Set-Cookie;

    # Main Django application
    location / {
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto https;
        proxy_set_header Host $http_host;
        proxy_redirect off;
        proxy_read_timeout 300;
        proxy_send_timeout 90;
        proxy_connect_timeout 90;

        if (!-f $request_filename) {
            proxy_pass http://django:8000; # <- Use container name from DOCKER COMPOSE file
            break;
        }
    }

    # Alfresco Community Edition location blocks
    location /alfresco/ {
        proxy_pass http://alfresco:8080; # <- Use container name from DOCKER COMPOSE file
        proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
        proxy_redirect off;
        proxy_buffering off;
        proxy_set_header Host            $host;
        proxy_set_header X-Real-IP       $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_pass_header Set-Cookie;
    }

    # Alfresco Share Web App
    location /share/ {
        proxy_pass http://alfresco-share:8080; # <- Use container name from DOCKER COMPOSE file
        proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
        proxy_redirect off;
        proxy_buffering off;
        proxy_set_header Host            $host;
        proxy_set_header X-Real-IP       $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_pass_header Set-Cookie;
    }


    # SOLR Web Console
    location /solr/ {
        proxy_pass http://alfresco-solr6:8983; # <- Use container name from DOCKER COMPOSE file
        proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
        proxy_redirect off;
        proxy_buffering off;
        proxy_set_header Host            $host;
        proxy_set_header X-Real-IP       $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_pass_header Set-Cookie;
    }

}

}
● nginx.service - A high performance web server and a reverse proxy server
     Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Sat 2021-09-25 19:18:44 HST; 1min 19s ago
       Docs: man:nginx(8)
    Process: 2272385 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FAILURE)

Sep 25 19:18:44 xubuntu-server systemd[1]: Starting A high performance web server and a reverse proxy server...
Sep 25 19:18:44 xubuntu-server nginx[2272385]: nginx: [emerg] host not found in upstream "django" in /etc/nginx/conf.d/nginx.conf:36
Sep 25 19:18:44 xubuntu-server nginx[2272385]: nginx: configuration file /etc/nginx/nginx.conf test failed
Sep 25 19:18:44 xubuntu-server systemd[1]: nginx.service: Control process exited, code=exited, status=1/FAILURE
Sep 25 19:18:44 xubuntu-server systemd[1]: nginx.service: Failed with result 'exit-code'.
Sep 25 19:18:44 xubuntu-server systemd[1]: Failed to start A high performance web server and a reverse proxy server.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants