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

Add Alpine Dockerfile #829

Closed
wants to merge 5 commits into from
Closed

Conversation

michaeljs1990
Copy link

@michaeljs1990 michaeljs1990 commented Dec 4, 2016

This adds a docker file that can be used to make deploying the application
easier. It does not focus on trying to be an all in one solution as you
still need to setup mysql. The full image is only 55.5MB and makes a small
change to the config file that lets you use environment variables to set
config values all name spaced with IPAM_* for safety.

  • add documentation for image
  • test out functionality more to ensure everything is in working order

Copy link
Author

@michaeljs1990 michaeljs1990 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Info for reviewer

$db['pass'] = "phpipamadmin";
$db['name'] = "phpipam";
$db['port'] = 3306;
$db['host'] = getenv('IPAM_HOST') ? getenv('IPAM_HOST') : "localhost";
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used this instead of the shorthand one since it looks like you still are trying to support php 5.1.

&& ln -sf /dev/stdout /var/log/apache2/access.log \
&& ln -sf /dev/stderr /var/log/apache2/error.log \
&& mkdir -p /run/apache2 \
&& sed -i 's/#LoadModule rewrite_module modules\/mod_rewrite.so/LoadModule rewrite_module modules\/mod_rewrite.so/' /etc/apache2/httpd.conf
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No fancy mod2en in alpine linux

&& ln -s /phpipam/config.dist.php /phpipam/config.php \
&& ln -sf /dev/stdout /var/log/apache2/access.log \
&& ln -sf /dev/stderr /var/log/apache2/error.log \
&& mkdir -p /run/apache2 \
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't know why but you need to create this or apache dies on startup since it can't create the pid file in this directory.

$ docker build -t phpipam .
$ docker run -p 8888:80 -e IPAM_HOST='192.168.1.5' -e IPAM_PASS='password' -e IPAM_USER='root' phpipam
```
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might want to move this all onto your site but it looks like you are using WP right now for hosting that.

AllowOverride All
Require all granted
</Directory>
</VirtualHost>
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kept apache.conf simple since I would except most people host this behind an HTTPS terminating load balancer or are using it in an environment where they don't care if it's over HTTPS.

@michaeljs1990
Copy link
Author

The php ctype module is needed as well for running the application which is not listed in your install docs.

@mrlesmithjr
Copy link

mrlesmithjr commented Dec 4, 2016

@michaeljs1990 I did this with Ansible, Alpine for Docker if you want to check it out as it might give you some guidance. Maybe, maybe not. Just thought I would share as it might be some help for you.

https://github.com/mrlesmithjr/docker-ansible-phpipam/tree/alpine

Specifically, what is going on in this https://github.com/mrlesmithjr/docker-ansible-phpipam/blob/alpine/config/ansible/playbook.yml

@michaeljs1990
Copy link
Author

nice thanks, the crons and dependencies list is very helpful 👍

@mrlesmithjr
Copy link

You got it man! Hope it helps some.

@phpipam phpipam self-assigned this Jan 9, 2017
@phpipam phpipam added this to the 1.4 milestone Jan 9, 2017
@michaeljs1990
Copy link
Author

Would love to get this into the repository let me know if i can do any other work on this.

This adds a docker file that can be used to make deploying the application
easier. It does not focus on trying to be an all in one solution as you
still need to setup mysql. The full image is only 55.5MB and makes a small
change to the config file that lets you use environment variables to set
config values all namespaced with IPAM_* for safty.
This adds some simple docs on how to get the container running as well as a missing
ctype package which i found throwing some errors.
rebased and ran into a bunch of issues since submodules are now required and
no errors are visible in the UI when they fail to load in. For whatever reason
on initial install the password will not set I have tried 3 different times
something is going on that I will try to debug but i can see after i reset the password
an error about php mailer is puked out so likely something to do with that (it's about
an email not being valid).

Some work also needs to be done around the database install process to better support
docker out of the box. The automated install is super nice but only allowing access to
localhost through this method means you have to log into mysql and run commands. Adding
an additional checkbox to the process like "allow remote access" or otherwise would fix
this up. I could see some security concerns around this since it is opening up mysql to
the world however if you do not have your firewall setup or are not running your db in a
container where the port is hidden from the outside world.
@GaryAllan
Copy link
Collaborator

Thanks. I've added a Dockerfile but taken a different approach for the ENV variables. See #2425

@GaryAllan GaryAllan closed this Feb 6, 2019
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 this pull request may close these issues.

None yet

4 participants