Coder Social home page Coder Social logo

Comments (19)

gerardvidamo avatar gerardvidamo commented on June 10, 2024

I tried running:
rm -rf /opt/vestacp && mkdir -p /opt/vestacp/{vesta,home,backup} && docker run -v /opt/vestacp/vesta:/vesta -v /opt/vestacp/home:/home -v /opt/vestacp/backup:/backup niiknow/vestacp:latest

Output

root@fleximi-web:~# docker pull niiknow/vestacp:latest
latest: Pulling from niiknow/vestacp
Digest: sha256:46d005459ff3ec9eea876fb6cc6c5035f1c2bc3f9377200ed3f74efce539c36c
Status: Image is up to date for niiknow/vestacp:latest
root@fleximi-web:~# rm -rf /opt/vestacp && mkdir -p /opt/vestacp/{vesta,home,backup} && docker run -v /opt/vestacp/vesta:/vesta -v /opt/vestacp/home:/home -v /opt/vestacp/backup:/backup niiknow/vestacp:latest
*** Running /etc/my_init.d/startup.sh...
[i] running for the 1st time
file has vanished: "/vesta-start/local/vesta/data/ips/172.17.0.3"
rsync warning: some files vanished before they could be transferred (code 24) at main.c(1183) [sender=3.1.1]
[i] init nginx
[i] init fail2ban
[i] running /home/admin/bin/my-startup.sh
 * Starting Apache httpd web server apache2
 *
 * Starting MariaDB database server mysqld
   ...done.
 * Starting PostgreSQL 9.6 database server
 * The PostgreSQL server failed to start. Please check the log output:
2018-05-09 03:27:02.370 UTC [458] FATAL:  could not map anonymous shared memory: Cannot allocate memory
2018-05-09 03:27:02.370 UTC [458] HINT:  This error usually means that PostgreSQL's request for a shared memory segment exceeded available memory, swap space, or huge pages. To reduce the request size (currently 2233131008 bytes), reduce PostgreSQL's shared memory usage, perhaps by reducing shared_buffers or max_connections.
2018-05-09 03:27:02.370 UTC [458] LOG:  database system is shut down
   ...fail!
[i] running /bin/vesta-auto-ssl.sh
[i] vesta-auto-ssl exit due to empty VESTA_DOMAIN variable
*** Running /etc/rc.local...
*** Booting runit daemon...
*** Runit started as PID 477
May  9 03:27:02 3fe3b85d70a5 syslog-ng[484]: syslog-ng starting up; version='3.5.6'
May  9 03:30:01 3fe3b85d70a5 CRON[494]: (admin) CMD (sudo /usr/local/vesta/bin/v-update-sys-queue webstats)
May  9 03:30:01 3fe3b85d70a5 CRON[495]: (admin) CMD (sudo /usr/local/vesta/bin/v-update-sys-rrd)
May  9 03:30:01 3fe3b85d70a5 CRON[493]: (admin) CMD (sudo /usr/local/vesta/bin/v-update-sys-queue backup)

And running:
docker exec b3cb5382bc33 netstat -tulpn

Output

root@fleximi-web:~# docker exec b3cb5382bc33 netstat -tulpn
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 127.0.0.1:8080          0.0.0.0:*               LISTEN      43/apache2
tcp        0      0 127.0.0.1:8081          0.0.0.0:*               LISTEN      43/apache2
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      355/sshd
tcp        0      0 127.0.0.1:8443          0.0.0.0:*               LISTEN      43/apache2
tcp6       0      0 :::3306                 :::*                    LISTEN      -
tcp6       0      0 :::22                   :::*                    LISTEN      355/sshd

from vestacp.

noogen avatar noogen commented on June 10, 2024

@gerardvidamo sorry, I fixed issue #47 but did not mark as latest. Please run niiknow/vestacp:1.3.4 and remember to map your port: -p 80:80 -p 443:443 -p 8083:8083

Postgres failure is probably causing the vesta not to start. When Postgres is running and before /bin/vesta-auto-ssl.sh, vesta should start with the follow log which I do not see from your report above:

 * Starting vesta-nginx vesta-nginx
   ...done.
 * Starting vesta-php vesta-php
   ...done.

I will also go update the latest docker hub to point to 1.3.4.

from vestacp.

gerardvidamo avatar gerardvidamo commented on June 10, 2024

@gerardvidamo sorry, I fixed issue #47 but did not mark as latest. Please run niiknow/vestacp:1.3.4 and remember to map your port: -p 80:80 -p 443:443 -p 8083:8083

@noogen Thank you! its up and running now.

root@fleximi-web:~# docker exec 4b09e44a84e7 netstat -tulpn
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 127.0.0.1:8080          0.0.0.0:*               LISTEN      6370/apache2
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      6131/nginx.conf
tcp        0      0 127.0.0.1:8081          0.0.0.0:*               LISTEN      6370/apache2
tcp        0      0 0.0.0.0:8083            0.0.0.0:*               LISTEN      378/vesta-nginx
tcp        0      0 127.0.0.1:8084          0.0.0.0:*               LISTEN      6131/nginx.conf
tcp        0      0 172.17.0.2:53           0.0.0.0:*               LISTEN      -
tcp        0      0 127.0.0.1:53            0.0.0.0:*               LISTEN      -
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      391/sshd
tcp        0      0 0.0.0.0:5432            0.0.0.0:*               LISTEN      -
tcp        0      0 127.0.0.1:953           0.0.0.0:*               LISTEN      -
tcp        0      0 127.0.0.1:8443          0.0.0.0:*               LISTEN      6370/apache2
tcp6       0      0 :::3306                 :::*                    LISTEN      -
tcp6       0      0 :::53                   :::*                    LISTEN      -
tcp6       0      0 :::22                   :::*                    LISTEN      391/sshd
tcp6       0      0 :::5432                 :::*                    LISTEN      -
udp        0      0 172.17.0.2:53           0.0.0.0:*                           -
udp        0      0 127.0.0.1:53            0.0.0.0:*                           -
udp6       0      0 :::53                   :::*                                -

Different Issue

About dotnet feature in runtime. I'm just wondering if I can run and test it using niiknow/vestacp:1.3.4. Is there any references that I can use?

from vestacp.

noogen avatar noogen commented on June 10, 2024

@gerardvidamo yes you can. No reference because the vesta panel does not support dotnet. I do most of it manually as I am familiar with both nginx proxy and dotnet. I run a lot of other things manually in Vesta mostly because the benefit of my content being backed up by the panel script.

from vestacp.

gerardvidamo avatar gerardvidamo commented on June 10, 2024

@noogen so by default its active now? I just need an idea so I can test dotnet run while hosted using vestacp. (I want to test if it can run multiple dotnet application with multiple sites in vestacp)

from vestacp.

noogen avatar noogen commented on June 10, 2024

@gerardvidamo yes, it is active. As this is Ubuntu, you can run it as daemon with SystemD: http://pmcgrath.net/running-a-simple-dotnet-core-linux-daemon

I also have runit installed (https://wiki.archlinux.org/index.php/runit) as alternative since people has reported that SystemD is known to have shutdown and startup issues under docker. I haven't experience any issue with SystemD as most of the services in the container are running with systemd right now anyway: apache, nginx, vesta, etc... I also run my own custom golang stuff and even github clone (gogs) on this panel. Example: https://github.com/niiknow/vestacp/blob/master/rootfs/etc/init.d/gogs

from vestacp.

gerardvidamo avatar gerardvidamo commented on June 10, 2024

@noogen So I have to run it as deamon with SystemD where my website dir is located?
root@fleximi-web:/opt/vestacp/home/admin/web/fleximi.com# ls

cgi-bin document_errors logs private public_html public_shtml stats

Under public_html?

from vestacp.

noogen avatar noogen commented on June 10, 2024

@gerardvidamo Usually, you want to use public_html.

Emphasis on usually because it depends on your template. How this panel work is: nginx->proxy->apache/dotnet/gogs/php-fpm/etc...

Usually, you would pick the default template: https://github.com/serghey-rodin/vesta/blob/master/install/ubuntu/16.04/templates/web/nginx/default.tpl - this is all done with the panel UI on the web tab/menu.

default template

  • Proxy to apache
  • Serve static content directly from public_html

The problem is that we don't want apache proxy, we want to proxy to your dotnet app. I added custom template for this purpose. It is a simple and clean template: https://github.com/niiknow/vestacp/blob/master/rootfs/sysprepz/nginx-templates/custom.tpl

I also add the ability to have custom nginx.conf file under the private folder: https://github.com/niiknow/vestacp/blob/master/Dockerfile#L392

Therefore, you would pick custom template and add /home/admin/web/fleximi.com/private/nginx.conf:

location / {
  # force https-redirects
  if ($scheme = http) {
    return 301 https://$server_name$request_uri;
  }

# replace 10080 with your dotnet port
  proxy_pass      http://127.0.0.1:10080;
}

location /error/ {
  alias   /home/admin/web/fleximi.com/document_errors/;
}

# replace 10080 with your dotnet port
location @fallback {
  proxy_pass      http://127.0.0.1:10080;
}

location ~ /\.ht    {return 404;}
location ~ /\.svn/  {return 404;}
location ~ /\.git/  {return 404;}
location ~ /\.hg/   {return 404;}
location ~ /\.bzr/  {return 404;}

As for where you put your dotnet files, it's all up to you because you are proxying it to your dotnet app; public_html may be fine for this unless you have security concern.

from vestacp.

gerardvidamo avatar gerardvidamo commented on June 10, 2024

@noogen I will try that and see how it works.

Also when I do a VPS soft reboot the ContainerID changed and the docker for VestaCP doesn't show in http://VPS_IP:8083.

from vestacp.

noogen avatar noogen commented on June 10, 2024

@gerardvidamo huh? Do you mean that it didn't restart after reboot? Did you set a restart policy parameter to the docker run? https://docs.docker.com/config/containers/start-containers-automatically/

from vestacp.

gerardvidamo avatar gerardvidamo commented on June 10, 2024

@gerardvidamo huh? Do you mean that it didn't restart after reboot? Did you set a restart policy parameter to the docker run? https://docs.docker.com/config/containers/start-containers-automatically/

@noogen Sorry its working fine now, I forgot to set a restart policy my bad.

Im about to try the DotNet Web runtime with VestaCP to do some testing. I'll keep you posted.

from vestacp.

gerardvidamo avatar gerardvidamo commented on June 10, 2024

@noogen So I did the dotnet run test to see if it running and then trying to check http://mydomain.com.

I added /home/admin/web/fleximi.com/private/nginx.conf using port 5000 and set the vestacp nginx settings for this site using custom template is checked.

Output in my VPS

 2018-05-11 13:12:02 ⌚  localhost in /opt/vestacp/home/admin/web/fleximi.com/dotnettest
○ → dotnet run
Hosting environment: Production
Content root path: /opt/vestacp/home/admin/web/fleximi.com/dotnettest
Now listening on: http://localhost:5000
Application started. Press Ctrl+C to shut down

Is there any reason why its not showing or am I missing something? Haven't done deamon with SystemD yet.

from vestacp.

noogen avatar noogen commented on June 10, 2024

@gerardvidamo Maybe try to bind to 0.0.0.0 instead of localhost? ref: aspnet/KestrelHttpServer#639

If you're binding to localhost, it can only be access locally which you can check with curl from inside the container.

from vestacp.

gerardvidamo avatar gerardvidamo commented on June 10, 2024

@gerardvidamo Maybe try to bind to 0.0.0.0 instead of localhost? ref: aspnet/KestrelHttpServer#639

If you're binding to localhost, it can only be access locally which you can check with curl from inside the container.

@noogen Its working now with the port 5001 using this nginx.conf custom template.

location / {
  # force https-redirects
  if ($scheme = http) {
    return 301 https://$server_name$request_uri;
  }

# replace 10080 with your dotnet port
  proxy_pass      http://127.0.0.1:5001;
}

location /error/ {
  alias   /home/admin/web/fleximi.com/document_errors/;
}

# replace 10080 with your dotnet port
location @fallback {
  proxy_pass      http://127.0.0.1:5001;
}

location ~ /\.ht    {return 404;}
location ~ /\.svn/  {return 404;}
location ~ /\.git/  {return 404;}
location ~ /\.hg/   {return 404;}
location ~ /\.bzr/  {return 404;}

http://domain.com is not showing up but shows in http://domain.com:5001. I also selected custom template in vestacp for the current domain.

Also in multiple domains, they are all sharing in 5001 ports. I'm not sure if the proxy pass is passing to the current domain.

from vestacp.

noogen avatar noogen commented on June 10, 2024

@gerardvidamo in dotnet, bind to 127.0.0.1 if you're doing proxy pass configuration above.

Otherwise (option 2), change the 2 lines:

proxy_pass      http://127.0.0.1:5001;

to:

proxy_pass      http://0.0.0.0:5001;

Also remember to restart nginx after making the changes.

Remember, binding to 127.0.0.1 is for local only. You can only access from inside the container. I usually bind 127.0.0.1 as seen in my nginx conf example. It guarantee that the only external access to my service is through nginx. If you want to directly test it externally, then you want to bind to 0.0.0.0 and that is what I suggested for your testing in earlier reply.

from vestacp.

gerardvidamo avatar gerardvidamo commented on June 10, 2024

@noogen This is my settings:

location / {
  # force https-redirects
  if ($scheme = http) {
    return 301 https://$server_name$request_uri;
  }

# replace 10080 with your dotnet port
  proxy_pass      http://0.0.0.0:5001;
  proxy_http_version 1.1;
  proxy_set_header Upgrade $http_upgrade;
  proxy_set_header Connection keep-alive;
  proxy_set_header Host $host;
}

location /error/ {
  alias   /home/admin/web/demo.fleximi.com/document_errors/;
}

# replace 10080 with your dotnet port
location @fallback {
  proxy_pass      http://0.0.0.0:5001;
}

location ~ /\.ht    {return 404;}
location ~ /\.svn/  {return 404;}
location ~ /\.git/  {return 404;}
location ~ /\.hg/   {return 404;}
location ~ /\.bzr/  {return 404;}

dotnet run time in port 5001

root@localhost:/opt/vestacp/home/admin/web/demo.fleximi.com/dotnettest# dotnet run
Hosting environment: Production
Content root path: /opt/vestacp/home/admin/web/demo.fleximi.com/dotnettest
Now listening on: http://[::]:5001
Application started. Press Ctrl+C to shut down.

I have two domains http://domain.com and http://sub.domain.com, now when I'm running dotnet using port 5001 it doesn't shows up in http://sub.domain.com which is demo.fleximi.com and it only works when http://sub.subdomain:5001 is used. Also it shows up in the main domain http://domain.com with port 5001(http://domain.com:5001). Nginx is restarted too plus a soft reboot to make it sure.

from vestacp.

noogen avatar noogen commented on June 10, 2024

@gerardvidamo This is your panel setup for proxy right?

screen shot 2018-05-11 at 11 22 09 pm

Note the nginx custom template is selected for proxy. In this config, it is assumed that your primary domain is set to fleximi.com and aliases is demo.fleximi.com. Otherwise, if your primary is set to demo.fleximi.com, then just leave Aliases setting empty.

from vestacp.

gerardvidamo avatar gerardvidamo commented on June 10, 2024

@noogen Yes, that's the settings that I have.

Settings for demo.fleximi.com

  • Proxy Support (nginx) checked
  • Proxy Template is set to custom
  • Alias is empty for demo.fleximi.com

the nginx.conf template that I have is in /opt/vestacp/home/admin/web/demo.fleximi.com/private/ (private dir)

from vestacp.

noogen avatar noogen commented on June 10, 2024

There were some issue with ssl template in older version which should be fixed. Old ticket, closing.

from vestacp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.