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

[Documentation] Offline Install Instructions: Docker #1930

Open
jeddai opened this issue Dec 29, 2021 · 3 comments · May be fixed by #3959
Open

[Documentation] Offline Install Instructions: Docker #1930

jeddai opened this issue Dec 29, 2021 · 3 comments · May be fixed by #3959
Assignees

Comments

@jeddai
Copy link
Collaborator

jeddai commented Dec 29, 2021

These instructions are for setting up a persistent instance of the Homebrewery application locally using Docker.

If you intend to develop with Homebrewery, following the Homebrewery application section of this guide is not recommended. Using docker to deploy MongoDB locally for development is not a bad idea at all, however.

Install Docker

Desktop Client (MacOS/Windows)

You can set up the docker engine to start on boot via the Docker desktop UI.

Docker Engine

Manage Docker as a non-root user (highly recommended)
Enable Docker to start on boot (highly recommended)

Run Mongo

docker run --name homebrewery-mongodb -d --restart unless-stopped -v mongodata:/data/db -p 27017:27017 mongo:latest

If your distribution is running on an arm device such as a Raspberry Pi, you will need to run the arm-built MongoDB v4.4.

docker run --name homebrewery-mongodb -d --restart unless-stopped -v mongodata:/data/db -p 27017:27017 arm64v8/mongo:4.4

Run Homebrewery

Build Homebrewery Image

git clone https://github.com/naturalcrit/homebrewery.git
cd homebrewery
docker-compose build homebrewery

Set up Configuration

Create the following file at config/docker.json

{
  "host" : "localhost:8000",
  "naturalcrit_url" : "local.naturalcrit.com:8010",
  "secret" : "secret",
  "web_port" : 8000,
  "enable_v3" : true,
  "mongodb_uri": "mongodb://host.docker.internal/homebrewery"
}

Run the Container

# Make sure you run this in the homebrewery directory
docker run --name homebrewery-app -d --restart unless-stopped -e NODE_ENV=docker -v $(pwd)/config/docker.json:/usr/src/app/config/docker.json -p 8000:8000 docker.io/library/homebrewery:latest

Updating the App

Whenever Homebrewery pushes out an update and you want to update your version of the app to include the changes, follow these steps to update the app.

docker rm -f homebrewery-app
cd homebrewery
git pull
docker-compose build homebrewery
docker run --name homebrewery-app -d --restart unless-stopped -e NODE_ENV=docker -v $(pwd)/config/docker.json:/usr/src/app/config/docker.json -p 8000:8000 docker.io/library/homebrewery:latest
@G-Ambatte
Copy link
Collaborator

Set up Configuration

Create the following file at config/docker.json

{
"host" : "localhost:8000",
"naturalcrit_url" : "local.naturalcrit.com:8010",
"secret" : "secret",
"web_port" : 8000,
"enable_v3" : true,
"mongodb_uri": "mongodb://host.docker.internal/homebrewery"
}

Is there a reason not to include this content in a file inside the install/docker directory, and direct the user to copy it to config/docker.json? Seems to me that doing so would make it simpler for the user to complete the install, as opposed to asking them to create a new text file and copy/paste the required content into it.

Also, don't the Docker and Git commands remain the same across different OS installs? If so, could we put these instructions into an install script?

@jeddai
Copy link
Collaborator Author

jeddai commented Dec 29, 2021

No particular reason for it, that's a good idea.

And yes we can make a script that runs all this. We'll need to include a check for the architecture to make sure we run the right version of MongoDB.

@ApatheticSheep
Copy link

ApatheticSheep commented Mar 2, 2022

The MongoDB docker image may not run on older CPUs - those that do not support AVX. (edit: yes I have geriatric hardware)

(dc) me@dockerdev:~/git/github/homebrewery$ docker logs b646d75d4a97

WARNING: MongoDB 5.0+ requires a CPU with AVX support, and your current system does not appear to have that!
  see https://jira.mongodb.org/browse/SERVER-54407
  see also https://www.mongodb.com/community/forums/t/mongodb-5-0-cpu-intel-g4650-compatibility/116610/2
  see also https://github.com/docker-library/mongo/issues/485#issuecomment-891991814

I was able to get Homebrewery running in a docker container with the bitnami/mongodb container. I speculate that the Bitnami container is compiled with different options.

(dc) me@dockerdev:~/git/github/homebrewery$ git diff
diff --git a/docker-compose.yml b/docker-compose.yml
index f74fadc..bdf1a88 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -1,7 +1,7 @@
 version: '2'
 services:
   mongodb:
-    image: mongo:latest
+    image: bitnami/mongodb:latest
     volumes:
       - mongodata:/data/db
   homebrewery:

dbolack-ab pushed a commit to dbolack-ab/homebrewery that referenced this issue Dec 21, 2024
Updates README.DOCKER.md and Dockerfile
@dbolack-ab dbolack-ab linked a pull request Dec 21, 2024 that will close this issue
4 tasks
@dbolack-ab dbolack-ab self-assigned this Dec 21, 2024
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

Successfully merging a pull request may close this issue.

4 participants