astral icon indicating copy to clipboard operation
astral copied to clipboard

Add docker files

Open unsync opened this issue 3 years ago • 16 comments

In response to https://github.com/astralapp/astral/issues/212

unsync avatar Oct 05 '20 06:10 unsync

Thanks for doing this! Now that I can take a closer look, I have a few questions:

  1. Is there a reason you chose Apache over Nginx? Myself (and most Laravel services like Homestead, Valet, etc) use Nginx. The production app also uses Nginx, and it might make sense to have them match.
  2. Is it difficult to set the timezones to just use UTC? I think thats the most generic option for everyone.
  3. Does the .env.template file need to exist, since we already have a .env.example file in the root?

syropian avatar Oct 05 '20 13:10 syropian

  1. Main reason was to use standard php images as a base, and they provide one with apache. My go-to is usually nginx, but i was aiming for simplicity in this proof of concept, rewriting it to use nginx could be doable
  2. I see you point about timezones, that is my bad, used my personnal templates to do this ^^
  3. Depending on how the docker files are placed into the project, it might not be usefull. The idea is to have a .env file that is read by default by docker, to be able to easly change the configuration, but as you might have seen, the content is the same as the .env file of the project

unsync avatar Oct 05 '20 13:10 unsync

@unsync

  1. Gotcha, if it's too much hassle to switch it to Nginx, don't worry about it.
  2. All good! I figured as much 😄
  3. Yeah, would be nice if we could somehow instruct Docker to use the default .env in the root. Not a huge deal I suppose, but any time the env gets updated, it's just one more place we need to update which is a bit of a pain.

syropian avatar Oct 05 '20 13:10 syropian

  1. you have two use cases (that i can hink of) : a. using docker for local developement. In that case, using the same .env is cool, don't need to modify it in two places b. distributing astral with docker hub. In that case, you start with an empty folder, copy the docker-compose file, copy the template .env.tpl and that's it.

Not sure if there is a definitive answer to this, it might depend on how you consider distributing astral with docker ?

unsync avatar Oct 05 '20 13:10 unsync

@unsync I could be totally off the mark but I assumed people who wanted Docker support mostly wanted it as a local dev tool.

syropian avatar Oct 11 '20 04:10 syropian

That is actually a very good question ! Personally I did this setup thinking about hosting my own astral server... but if this docker setup is aiming at developers, it could be done differently. Having some feedback about this should be interesting !

unsync avatar Oct 15 '20 16:10 unsync

As originally stated in #212 I think the Docker image should be targeted at users who wish to self-host the application. I'm not too familiar with PHP applications but shouldn't the Docker image this application provides be using PHP-FPM for its entrypoint and allow the user to select the webserver of their choice to reverse proxy to traffic to the application container? Containing both a web server and application in one image is kind of a Docker anti-pattern IMO.

h1nk avatar Nov 08 '20 10:11 h1nk

@h1nk Thanks for chiming in, and in that case I believe you're right, the web server just shouldn't be part of the image. I don't know what changes would be required to create a good container for self-hosting, so I'm kinda leaning on the community here 😅

syropian avatar Nov 08 '20 15:11 syropian

@h1nk your anti-pattern point is valid, yet the php-apache docker image is a fairly popular base image in the docker ecosystem, and nothing actually stops you from reverse-proxying from the current image (to use something like traefik in order to use you own https domain).

My first goal was to have something simple to configure and more accessible for users (get traefik+mysql+astral in a docker-composer, and off you go). If the prefered approach is to be more "atomical" in the docker-compose, then indeed we can provide a Dockerfile with only php-fpm, no problem :) The first downside i see, is that if you separate php you then have to share a volume b/w php and your webserver, opposed to the single php-apache config that saves you the trouble of having to configure a volume, etc

unsync avatar Nov 21 '20 11:11 unsync

Hey, are people still interested in this? I personally would be, and I'd like to help

I believe @h1nk is right about it being a Docker anti-pattern but it is definitely very helpful for people who run something as https://github.com/linuxserver/docker-swag and use it as their main entry point for all other containers. I think if it would be able to run Astral with just Node, it would make the Docker image less bloated and we would not be running a typical web server such as Nginx or Apache behind another web server for those that use the SWAG image referenced above.

An example of this is the following Docker image https://github.com/itzg/docker-rcon-web-admin/blob/master/Dockerfile which you are then able to reverse proxy from SWAG or your web server container

obvionaoe avatar Aug 26 '21 09:08 obvionaoe

@obvionaoe Yes, I'd definitely still like to see an official Docker image for this project. Something that just runs php-fpm, exposes a TCP port and leaves it up to the user to setup fastcgi_pass on their own would be nice.

h1nk avatar Sep 04 '21 13:09 h1nk

if someone could help me understand how to run php-fpm in Docker I can do the rest of the work! I've tried running a lot of the php images and they always have some issues

obvionaoe avatar Oct 31 '21 17:10 obvionaoe

Agreed, I would love to see a php-fpm container but I think for new users a standalone container in the style of linuxservers.io or similar would be better, I'm using the cloud service atm but I'm anxious about affecting other users perf with my over 10k+ stars :P

agnosticlines avatar Jan 17 '22 10:01 agnosticlines

I didn't know that there are other people with more than 10k+ stars. (ref. https://github.com/maguowei/starred/issues/116)

Does Astral handle this amount well, also in the proposed container? The app.astralapp.com always loggs me out when fetching the initial list.

It shouldn't be too hard to get a Compose going for a decoupled Nginx + PHP-FPM setup, very much like the one from Nextcloud. We only need to find a good Nginx template, that works well in accordance with the to be proposed Compose environment.

almereyda avatar Dec 07 '23 15:12 almereyda

I didn't know that there are other people with more than 10k+ stars. (ref. maguowei/starred#116)

Does Astral handle this amount well, also in the proposed container? The app.astralapp.com always loggs me out when fetching the initial list.

It shouldn't be too hard to get a Compose going for a decoupled Nginx + PHP-FPM setup, very much like the one from Nextcloud. We only need to find a good Nginx template, that works well in accordance with the to be proposed Compose environment.

Unfortunately in my testing it doesn't, it doesn't log me out but it just keeps increasing the amount of stars, way over the amount I had, it got to like 100k at one point and when I refreshed it reset

agnosticlines avatar Dec 13 '23 14:12 agnosticlines

Dear Astral's users,

Although this post is old, I would like to know if the community has progressed with installing Astral through Docker. So far, I have not seen clear installation instructions for a non-skilled user like me. Nevertheless, there are four good attempts to install Astral with Docker:

I would appreciate knowing if somebody could test Astral with Docker in 2024.

fdbesanto2 avatar Mar 30 '24 18:03 fdbesanto2