UDOIT icon indicating copy to clipboard operation
UDOIT copied to clipboard

Document server install process for NGINX

Open bagofarms opened this issue 3 years ago • 6 comments

The Heroku install process is pretty well defined at this point, but hosting the app on your own server using Apache or NGINX as the web server is currently undocumented. We should document two use cases:

  1. Running UDOIT in a Docker container using an external database server and NGINX
  2. Running UDOIT directly on the server using an external database server and NGINX

This particular issue is aimed at NGINX because that is what UCF uses. I will create another issue specifically for Apache.

bagofarms avatar Nov 19 '21 22:11 bagofarms

I've been working on some changes and using NGINX was much easier than running Apache. I'd vote for removing Apache from the main Dockerfile and just improving the process so it can run without these modifications.

The changes I made

  • Install NGINX, remove Apache
  • Add a basic nginx_app.conf file and make it available as the default site
  • Modify NGINX source to write all logs to stdout instead of files
  • Delete the user line since it doesn't need to switch users if already running as non root
  • Add a supervisord process to start NGINX

You could run NGINX in a separate container too, but for cost/simplicity we've decided to run both php-fpm and NGINX together.

jonespm avatar Jan 19 '22 16:01 jonespm

I have worked out how to run Apache, but it did take some work, mostly because I barely knew what I was doing :-). The core of it was in Dockerfile:

RUN a2enmod rewrite && a2enmod proxy && a2enmod proxy_fcgi RUN echo "ServerName localhost" >> /etc/apache2/apache2.conf RUN sed -i 's/80/8000/' /etc/apache2/ports.conf COPY deploy/000-default.conf /etc/apache2/sites-available/000-default.conf ... ENTRYPOINT ["deploy/udoit-start.sh"]

If I felt remotely comfortable with github, I'd fork, but attaching the two referenced files.

udoit-start.sh.txt 000-default.conf.txt

dtod avatar Jan 19 '22 16:01 dtod

@jonespm Can you create a PR that includes just your NGINX changes? @dtod I'll reference your comment in the apache issue so we can incorporate your changes when we get to that issue.

bagofarms avatar Feb 03 '22 19:02 bagofarms

@jonespm I'm looking to make NGINX the default inside our Docker container and I've been trying to port your Dockerfile.umich to work on the latest development branch. I believe I almost have it working, but we need PHP 8.1 and PHP 7.4 is installed by Dockerfile.umich. Can you point me in the direction of the Dockerfile for ghcr.io/tl-its-umich-edu/udoit:v3.0.1?

rob-3 avatar Feb 17 '22 22:02 rob-3

Sorry @rob-3 haven't had time to look into this.

The source of this is just the Dockerfile on the branch https://github.com/ucfopen/UDOIT/blob/v3.0.1/Dockerfile at revision 399badd7648f67aa30f2bf1d4bda6b552dc4a8bd. You can see in the build logs https://github.com/tl-its-umich-edu/UDOIT/runs/4599548779.

I'd like to talk to @bagofarms about adding as part of the release process a step that would create the Docker image in the main UCF repo so we can just pull from that and extend it. I did it manually with this workflow and just put in the SHA and what to tag it as. https://github.com/tl-its-umich-edu/UDOIT/blob/main/.github/workflows/docker-manual.yml

I wanted to try to keep my changes separate from the main fork. We have another build locally that just builds and deploys the Dockerfile.umich.

To update to PHP 8.1 you'll probably have to change the Dockerfile in the main UDOIT repo and get a new tag out.

jonespm avatar Mar 08 '22 20:03 jonespm

Ok, thanks for this info. I'm back from break and rewriting the Docker setup is my first priority.

rob-3 avatar Mar 14 '22 12:03 rob-3