chaosbunker / dockerbunker

a tool that helps configure, deploy and manage dockerized web-applications or static sites behind an nginx reverse proxy container
MIT License
73 stars 17 forks source link

Does this work on Mac? #8

Closed frakman1 closed 5 years ago

frakman1 commented 5 years ago

I tried following the instructions to install on my Mac but got this error:

$git clone https://github.com/chaosbunker/dockerbunker.git && cd dockerbunker
Cloning into 'dockerbunker'...
remote: Enumerating objects: 87, done.
remote: Counting objects: 100% (87/87), done.
remote: Compressing objects: 100% (62/62), done.
remote: Total 734 (delta 37), reused 61 (delta 24), pack-reused 647
Receiving objects: 100% (734/734), 479.82 KiB | 5.51 MiB/s, done.
Resolving deltas: 100% (356/356), done.

$./dockerbunker.sh
./dockerbunker.sh: line 56: declare: -A: invalid option
declare: usage: declare [-afFirtx] [-p] [name[=value] ...]
./dockerbunker.sh: line 58: ${service,,}: bad substitution
./dockerbunker.sh: line 69: Static HTML Site: syntax error in expression (error token is "HTML Site")

Please select the service you want to manage

1) Destroy everything
2) Exit
#? 
chaosbunker commented 5 years ago

It does, but you need Bash 4+, because dockerbunker is making use of features like associative arrays and parameter expansion. I kinda missed adding this to the readme, so thanks for asking!

If you have homebrew installed just do brew install bash and you should be good to go :-)

frakman1 commented 5 years ago

Thank you. I didn't think of upgrading the bash. That fixed it.

I'm sorry if this is a stupid question, but do I have to have nginx installed for this to work? I am trying to setup a Wekan server on my Mac but I can't get past setting the FQDN option. It keeps saying that it is invalid domain no matter what I type (even the one from the example mystatic.chaosbunker.me)

Wekan Service Domain (FQDN): mystatic.chaosbunker.me
usage: grep [-abcDEFGHhIiJLlmnOoqRSsUVvwxZ] [-A num] [-B num] [-C[num]]
    [-e pattern] [-f file] [--binary-files=value] [--color=when]
    [--context[=num]] [--directories=action] [--label] [--line-buffered]
    [--null] [pattern] [file ...]

mystatic.chaosbunker.me is not a valid domain
frakman1 commented 5 years ago

UPDATE It seems I had to upgrade grep too.

I got a little farther but it failed on some other things later:

Wekan Service Domain (FQDN): frakbookpro15.lan.wekan.me

Use Letsencrypt instead of a self-signed certificate? [y/n]: [No]
sed: 1: "/Users/frak/git/dockerb ...": invalid command code f
sed: 1: "/Users/frak/git/dockerb ...": invalid command code f
sed: 1: "/Users/frak/git/dockerb ...": invalid command code f
sed: 1: "/Users/frak/git/dockerb ...": invalid command code f

Please run "Setup service" next.

Wekan
1) Reconfigure service
2) Setup service
3) Destroy "Wekan"
4) Exit
#? 2

No nginx container found

→ Setup nginx

Pulling nginx:mainline-alpine
Error response from daemon: Get https://registry-1.docker.io/v2/library/nginx/manifests/mainline-alpine: unauthorized: incorrect username or password

Starting up nginx containerUnable to find image 'nginx:mainline-alpine' locally
docker: Error response from daemon: Get https://registry-1.docker.io/v2/library/nginx/manifests/mainline-alpine: unauthorized: incorrect username or password.
See 'docker run --help'.
 [failed]

→ Setup Wekan

No nginx container found

→ Setup nginx

Pulling nginx:mainline-alpine
Error response from daemon: Get https://registry-1.docker.io/v2/library/nginx/manifests/mainline-alpine: unauthorized: incorrect username or password

Starting up nginx containerUnable to find image 'nginx:mainline-alpine' locally
docker: Error response from daemon: Get https://registry-1.docker.io/v2/library/nginx/manifests/mainline-alpine: unauthorized: incorrect username or password.
See 'docker run --help'.
 [failed]

Pulling quay.io/wekan/wekan
Using default tag: latest
latest: Pulling from wekan/wekan
790c37dedd62: Already exists
a6f928baf450: Already exists
9455e1a4dae5: Already exists
Digest: sha256:57b28a6ed28154f7aadc3ab17455dcb8752807a43d8b2a375c0f9c172a057e62
Status: Image is up to date for quay.io/wekan/wekan:latest

Pulling mongo:3.2.12
Error response from daemon: Get https://registry-1.docker.io/v2/library/mongo/manifests/3.2.12: unauthorized: incorrect username or password

Creating volumes
- wekan-db-vol-2 ✔
- wekan-db-vol-1 ✔

Generating self-signed certificate for frakbookpro15.lan.wekan.me ✔
sed: 1: "/Users/frak/git/dockerb ...": invalid command code f

Moving nginx configuration in place ✔

Starting up containers
- wekan-service-dockerbunker ✔
- wekan-db-dockerbunkerUnable to find image 'mongo:3.2.12' locally
docker: Error response from daemon: Get https://registry-1.docker.io/v2/library/mongo/manifests/3.2.12: unauthorized: incorrect username or password.
See 'docker run --help'.
- wekan-db-dockerbunker (already running)

Restarting nginx containerError: No such container: nginx-dockerbunker
 [failed]

Error: No such container: nginx-dockerbunker

→ `nginx -t` failed. Trying to add missing containers to dockerbunker-network.

Restarting nginx containerError: No such container: nginx-dockerbunker
 [failed]

Error: No such container: nginx-dockerbunker

`nginx -t` failed again. Please resolve issue and try again.
sed: 1: "/Users/frak/git/dockerb ...": invalid command code f
sed: 1: "/Users/frak/git/dockerb ...": invalid command code f
sed: 1: "/Users/frak/git/dockerb ...": invalid command code f
sed: 1: "/Users/frak/git/dockerb ...": invalid command code f
sed: 1: "/Users/frak/git/dockerb ...": invalid command code f
[12:20 AM][frak@frakbookpro15][~/git/dockerbunker] branch:(master)

It looks like sed was having trouble too but I wasn't able to upgrade sed using homebrew.

frakman1 commented 5 years ago

UPDATE It seems I had to do a docker login from the command line (docker GUI login wasn't enough). To complicate matters, you can't use your email address as the username when logging in via the CLI. Instead, I had to use my username.

After logging in via CLI, I destroyed everything and started over. New errors:

#? 27

→ Checking service status

Wekan
1) Configure Service
2) Exit
#? 1

→ Configure Wekan

# Wekan Settings

Wekan Service Domain (FQDN): wekan.frakbookpro15.lan

Use Letsencrypt instead of a self-signed certificate? [y/n]: [No]
sed: 1: "/Users/frak/git/dockerb ...": invalid command code f
sed: 1: "/Users/frak/git/dockerb ...": invalid command code f
sed: 1: "/Users/frak/git/dockerb ...": invalid command code f
sed: 1: "/Users/frak/git/dockerb ...": invalid command code f

Please run "Setup service" next.

Wekan
1) Reconfigure service
2) Setup service
3) Destroy "Wekan"
4) Exit
#? 2

No nginx container found

→ Setup nginx

Pulling nginx:mainline-alpine
mainline-alpine: Pulling from library/nginx
4fe2ade4980c: Pull complete
e11b023b07a0: Pull complete
aaf7d5908de5: Pull complete
8ae3a5ca453f: Pull complete
Digest: sha256:94e890939a012d8494ac62a0cf6177c57f97522b35e231dad676e089e309d49d
Status: Downloaded newer image for nginx:mainline-alpine

Starting up nginx containerdocker: Error response from daemon: driver failed programming external connectivity on endpoint nginx-dockerbunker (bc14ac6dc1eef01fdea2e2a5a9ab7e326cfb4f12982f22857b98b0f72bd9a109): Bind for 0.0.0.0:80 failed: port is already allocated.
 [failed]

→ Setup Wekan

No nginx container found

→ Setup nginx

Pulling nginx:mainline-alpine
mainline-alpine: Pulling from library/nginx
Digest: sha256:94e890939a012d8494ac62a0cf6177c57f97522b35e231dad676e089e309d49d
Status: Image is up to date for nginx:mainline-alpine

Starting up nginx containerdocker: Error response from daemon: Conflict. The container name "/nginx-dockerbunker" is already in use by container "a911605fd5ae79025f3f04b36558fd70a3e7a13fc4939b004e6eec0cea386661". You have to remove (or rename) that container to be able to reuse that name.
See 'docker run --help'.
 [failed]

Pulling quay.io/wekan/wekan
Using default tag: latest
latest: Pulling from wekan/wekan
790c37dedd62: Already exists
a6f928baf450: Already exists
9455e1a4dae5: Already exists
Digest: sha256:57b28a6ed28154f7aadc3ab17455dcb8752807a43d8b2a375c0f9c172a057e62
Status: Image is up to date for quay.io/wekan/wekan:latest

Pulling mongo:3.2.12
3.2.12: Pulling from library/mongo
47e616392c23: Pull complete
b8dc044ce904: Pull complete
4ccb5ca0e379: Pull complete
3b1e4f984392: Pull complete
8a6016a58337: Pull complete
a21527fa8188: Pull complete
44adcaad2c76: Pull complete
ac4de227c77e: Pull complete
d2f665d49ba4: Pull complete
766e94e08ac1: Pull complete
b89f35cc5a28: Pull complete
Digest: sha256:af40f41f870c15e41d48bf2433134e0577f97d5ebbf55c4a2214ed499026a08e
Status: Downloaded newer image for mongo:3.2.12

Creating volumes
- wekan-db-vol-2 ✔
- wekan-db-vol-1 ✔

Generating self-signed certificate for wekan.frakbookpro15.lan ✔
sed: 1: "/Users/frak/git/dockerb ...": invalid command code f

Moving nginx configuration in place ✔

Starting up containers
- wekan-service-dockerbunker ✔
- wekan-db-dockerbunker ✔

Restarting nginx containerError response from daemon: Container a911605fd5ae79025f3f04b36558fd70a3e7a13fc4939b004e6eec0cea386661 is not running
 [failed]

Error response from daemon: Container a911605fd5ae79025f3f04b36558fd70a3e7a13fc4939b004e6eec0cea386661 is not running

→ `nginx -t` failed. Trying to add missing containers to dockerbunker-network.

Restarting nginx containerError response from daemon: Container a911605fd5ae79025f3f04b36558fd70a3e7a13fc4939b004e6eec0cea386661 is not running
 [failed]

Error response from daemon: Container a911605fd5ae79025f3f04b36558fd70a3e7a13fc4939b004e6eec0cea386661 is not running

`nginx -t` failed again. Please resolve issue and try again.
sed: 1: "/Users/frak/git/dockerb ...": invalid command code f
sed: 1: "/Users/frak/git/dockerb ...": invalid command code f
sed: 1: "/Users/frak/git/dockerb ...": invalid command code f
sed: 1: "/Users/frak/git/dockerb ...": invalid command code f
sed: 1: "/Users/frak/git/dockerb ...": invalid command code f
frakman1 commented 5 years ago

Despite the above errors, I was able to login to my localhost's Wekan server and get cracking! Awesome work. Thank you for making this possible!

The above errors however look pretty serious. I don't understand how it could be working with the above errors. Is this 'normal'?

chaosbunker commented 5 years ago

Ah, right .. i forgot about this, .. it's been a while since I did the foundation. You'll need GNU grep and GNU sed as well ..

You'll need to use the "--with-default-names" option, to make it work

brew install grep --with-default-names brew install gnu-sed --default-names

After installing those it might be a good idea to start all over again. Sorry about that inconvenience.

To address your first question .. you don't need to install nginx, it comes via the nginx container. it will say [invalid] for any domain, since for the regular expression, which checks if you entered a FQDN (Fully Qualified Domain Name) GNU grep is needed. So this is not the end of the world as long as you don't enter an invalid domain.

Regarding the sed error ... this article explains why the error is thrown. Solution for now: installing GNU Sed:-)

Let me know if there's anything else! And thanks for letting me know .. it was an oversight on my part, because the initial idea was to make this work on macOS as well..

edit: regarding the docker login issue .. not sure why this happened, couldn't reproduce. Those are all public repositories, so it's unusual that you needed to authorize

frakman1 commented 5 years ago

Homebrew commands don't make any difference. It says I already have them and that they are up to date. Destroying and starting over still gives me sed errors.

$brew install grep --with-default-names
Warning: grep 3.1 is already installed and up-to-date
To reinstall 3.1, run `brew reinstall grep`

$brew install gnu-sed --default-names
Warning: gnu-sed 4.5 is already installed and up-to-date
To reinstall 4.5, run `brew reinstall gnu-sed`
Wekan
1) Configure Service
2) Exit
#? 1

→ Configure Wekan

# Wekan Settings

Wekan Service Domain (FQDN): wekan.frakbookpro15.lan

Use Letsencrypt instead of a self-signed certificate? [y/n]: [No]
sed: 1: "/Users/frak/git/dockerb ...": invalid command code f
sed: 1: "/Users/frak/git/dockerb ...": invalid command code f
sed: 1: "/Users/frak/git/dockerb ...": invalid command code f
sed: 1: "/Users/frak/git/dockerb ...": invalid command code f

Have you had a chance to try it on a Mac yet? I'm happy to be the Mac platform tester if you don't. I'm just curious if you've already done this on a Mac or not.

xet7 commented 5 years ago

Running Wekan on Mac does not require dockerbunker. If you have Docker for Mac and docker-compose installed, just doing docker-compose up -d on wekan repo will start Wekan on port 80, I think. Or you could try for example port 2000, like in docker-compose.yml ports 2000:8080. Also, if you use Wekan on local LAN, you could set ROOT_URL=http://your-ip-address .

But, if you really need nginx,SSL, etc, they you could try to get dockerbunker working.

chaosbunker commented 5 years ago

That's correct, @xet7

Yes, @frakman1, I have actually partly developed this on my mac .. just tried and installed Wekan on my mac and it all worked as expected. You can have a look here https://asciinema.org/a/213429

If you already had GNU sed & GNU grep installed you first have to remove them and then install them again with --with-default-names

edit: add correct asciicast link

frakman1 commented 5 years ago

@xet7 Thanks for the tip. I was just following the first link in the wiki about Docker here

I think you are hinting at following the instructions listed here instead.

I'm confused about where the database file really is located on the filesystem. After running docker-compose up -d , Wekan does indeed work via http://127.0.0.1. I imported data from Trello but I can't find where the database is. I tried http://127.0.0.1:27017/ but got a connection refused. I also tried http://127.0.0.1:15432/wekan that I got from here but same error.

I'd really like to have access to the databse file itself even if only for read only operations to make my own queries on it.

frakman1 commented 5 years ago

@chaosbunker Thank you. Removing and Re-Installing grep and gnu-sed worked. I think I'm getting the hang of this now.

chaosbunker commented 5 years ago

Cheers :)

xet7 commented 5 years ago

@frakman1

Info about using mongo in Docker is at https://github.com/wekan/wekan/wiki/Backup#docker-backup-and-restore

MongoDB GUI like https://www.nosqlbooster.com maybe works to access MongoDB at localhost:27017

You can try to find raw mongodb files with locate command like at 2) at http://www.xet7.org/how-to-get-macos-mojave-brew-mysql-5-7-working-for-large-drupal-drush-dumps so after updatedb do locate wiredTiger | less or locate mongo | less or locate docker | less. You can edit mongodb with cli or gui, but do dot move raw database files when MongoDB is running.