Open praetorxyn opened 3 years ago
First of all i think @RyanNoelk did a great job, deviding the application in seperate services which makes them better manageable. This does come with the trade off, that setting it up is not trivial. And i agree the setup instruction are convoluted.
Let me know if this helped you:
use the docker-prod.yaml as a reference for your compose snippet. it pulls the image from docker hub.
# ....
services:
# ...
api:
image: openeats/openeats-api
command: /startup/prod-entrypoint.sh
restart: on-failure
volumes:
- static-files:/code/static-files
- site-media:/code/site-media
depends_on: # if your db is also in the compose
- db # or whatever your db service is called
env_file:
my.env
web:
image: openeats/openeats-web
command: yarn start
depends_on:
- api
volumes:
- public-ui:/code/build
env_file:
my.env
nginx:
# ...
# what ever you have configured for nginx stays. add the volumes for static file handling
volumes:
# ...
- static-files:/var/www/html/openeats-static/static-files
- site-media:/var/www/html/openeats-static/site-media
- public-ui:/var/www/html/openeats-static/public-ui
# ...
volumes:
# ...
public-ui:
static-files:
site-media:
take the stg_env.list as a reference for your env additions to your env file which i called "my.env" here
# Database config set it to the
#arbitrary name for the database leave it as is
MYSQL_DATABASE=openeats
# the db user that manages the database. does not have to be root but needs database create permissions
MYSQL_USER=root
# password of that user
MYSQL_ROOT_PASSWORD=root
# equals to the your db service name in
MYSQL_HOST=my_db
# the port on the db container (not the one that is mapped to on the host(
MYSQL_PORT=3306
# if you HAVE TO set this to any db engine that is [supported by the underlying django framework](https://docs.djangoproject.com/en/3.1/ref/settings/#engine)
# CAUTION: there is no gurantee this will actually work, as the maintainer might have added db specific code.
DATABASE_ENGINE=django.db.backends.mysql
# Django config
# leave all of them as is
API_URL=0.0.0.0:8000
API_PORT=8000
DJANGO_SETTINGS_MODULE=base.settings
DJANGO_DEBUG=False
#change this to something Random and do NOT share it anyware.
DJANGO_SECRET_KEY=sdfsadfas32e98zsdvhhsnz6udvbksjdhfi4galshjfg
# leave all of them as is
# Node config
NODE_ENV=production
NODE_URL=localhost:8080
NODE_LOCALE=en
#you can change api adress to the name of the api service ("api" in this example). if you do, you do not have to expose the api port on the host
NODE_API_URL=http://api
ALLOWED_HOST="localhost,api"
as for your nginx reverse proxy reuse the content of the nginx config
upstream api {
ip_hash;
server api:API_PORT;
}
server {`
listen 80;
server_name localhost; #<PUBLIC_FQDN_OF_YOUR_SERVER>
# ....
# your other services that are proxied by nginx
# change the location of the front end if you have something else on the root location
location / {
root /var/www/html/openeats-static/public-ui;
try_files $uri $uri/ /index.html;
}
location /static/ {
root /var/www/html/openeats-static/public-ui;
gzip on;
gzip_types text/plain text/xml text/css
text/comma-separated-values
text/javascript application/x-javascript
application/javascript
application/atom+xml;
expires max;
}
location /api/ {
proxy_pass http://api;
proxy_set_header Host $http_host;
}
location /admin/ {
proxy_pass http://api;
proxy_set_header Host $http_host;
}
location /static-files/ {
root /var/www/html/openeats-static;
try_files $uri /static-files/$uri;
}
location /site-media/ {
root /var/www/html/openeats-static;
try_files $uri /site-media/$uri;
}
}
i would definetly change this too https if you want to access your service from the internet to sth like
server {
listen 80 default_server;
location / {
return 301 https://$host$request_uri;
}
location /.well-known/acme-challenge/ {
root /var/www/certbot;
}
}
server {
listen 443 ssl;
ssl_certificate /etc/letsencrypt/live/<MY_FQDN>/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/<MY_FQDN>/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
client_max_body_size 4G;
location / {
....
I have multiple services already hosted using Docker Compose, including a dockerized mariadb which includes databases fro bitwardenrs-mysql and Nextcloud, and a dockerized letsencrypt / nginx with a configured reverse proxy.
I've been looking for a self hosted recipe management system, and I'd like to try out OpenEats. The issue is the instructions. They seem awfully convoluted compared to every other docker setup I've done, and just assume you don't have any existing docker infrastructure like a mariadb or nginx. It seems like using them would mean relying on a separate set of docker-compose files (which I automatically don't like, as all my other services are in a single one), and I'm also not even sure it would work, as my Synology NAS doesn't have git anyway, and only has python 2.7 instead of python 3.
All I'm looking for is the necessary docker-compose snippets / additions to my existing .env file that will let it just pull down the docker images like you'd normally expect and provision everything, without relying on a python script to manage it (because I see no need to use a different paradigm just for this when my existing paradigm is working fine for 5+ other services).
I can probably piece it together myself if I absolutely have to, but I am particularly concerned about the databse. In the official instructions, the bit about an existing database says:
My DB IS dockerized, so I assume I don't need those, but I want to make sure it isn't going to do anything with my mariadb besides create its own database.
I'd appreciate any help. I know the images exist on docker hub, so what I want to do should be possible, but the instructions on there are just the standard ones.