Changes

From Amahi Wiki
Jump to: navigation, search
2,465 bytes added ,  00:16, 7 September 2017
Lets assume we are trying to run multiple container apps. Let them be App1, App2, App3 and App4.
'''NOTE: ''' Each app will have its own networking stack and hence can run a service on any port that they want.
App1 - 9000, 80
EOF
docker-compose up -d
 
This script creates a docker-compose.yml file and then runs `docker-compose up -d` command which essentially creates and runs the container.
install_script = install_script.gsub(/APP_IDENTIFIER/, identifier)
install_script = install_script.gsub(/APP_HOSTNAME/, app_host)
 
Sample uninstall script
# Not removing the image. Just stopping the container.
For most containers the above uninstallation script will work fine. This stops the running container and removes it. Please note that this doesn't delete any of the volumes attached (persistent storage. Please refer to docker documentatio documentation for more details regarding volumes) with the container so if you add a volume during installation (as we have done in the gitlab example above) then we have to remove them here during uninstallation. For example if we were to remove gitlab completely along with all files that were added by gitlab container then the uninstall script would look something like this:
docker-compose stop
rm -rf srv # Removing the srv folder which holds the persistent files for gitlab container
 This behaviour behavior might not be intended for all applications. Right now I haven't removed static files for any apps that I have added.
===Reverse Proxy===
CustomLog APP_ROOT_DIR/logs/access_log combined env=!dontlog
</VirtualHost>
 
APP_PORT part is derived from the app id. After installation the app will have some id in the database base. The APP_PORT will be 35000+app_id
Please note that we can run any kind of app in container. It might be a headless app and it might be a webapp. In case of web applications we need to define an external port (mapped port on host - Refer to Architecture Overview section) through which the app will be bind. Then to reach that app we have to reverse proxy. "APP_PORT" is essentially that. For apps which don't require a web interface we might not use this file at all.
 
'''NOTE''': HOST_PORT and APP_PORT are basically same thing but in the code they are used at two different places with different names to avoid confusion as per the context. For example in the Reverse Proxy case, APP_PORT variable is present inside the file `app-container.conf`. Here we want to reverse proxy to an app running on some port so it was named as APP_PORT.For the HOST_PORT , it was used in app/models/app.rb file, their it represents the port to be used on the host machine and hence named that way. But for one particular app, value of HOST_PORT=APP_PORT.
==How to add a new app?==
-e TZ=<timezone> \
-p 5075:5075 linuxserver/hydra
 
Convert the above to a docker-compose file. Ignore the `-e PGID=<gid> -e PUID=<uid>`, even though it's relevant, it is out of the scope of this discussion.
- './downloads:/downloads'
- '/etc/localtime:/etc/localtime:ro'
# Understanding the volume mounts:
# ./config:/config -> As seen in the docker create commnad the -v command mentions the volumes.
# - TZ=<timezone>
# in the docker compose file
 
'''NOTE:''' Please note that adding apps might require knowledge about docker and docker-compose and discussing those is out of the scope of this documentation though the links mentioned below might be useful.
EOF
docker-compose up -d
 
Uninstall Script
rm -rf downloads # Use this if you want all files to be removed after uninstall
For more examples of install scripts and docker-compose files of different apps please refer to [https://github.com/vik-y/amahi_images amahi_images repo.] or the table given below.
For more {| class="wikitable"|+ <big>'''App examples of '''</big>! Example app ! install scripts and -script ! Image repository|-| coppermine||https://github.com/vik-y/amahi_images/tree/master/coppermine||https://github.com/vik-y/amahi_images/tree/master/coppermine|-| fengoffice||https://github.com/vik-y/amahi_images/tree/master/fengoffice||https://github.com/vik-y/amahi_images/tree/master/fengoffice|-| osticket||https://github.com/vik-y/amahi_images/tree/master/osticket||https://github.com/vik-y/amahi_images/tree/master/osticket|-| gitlab||https://github.com/vik-y/amahi_images/tree/master/gitlab||https://hub.docker.com/r/gitlab/gitlab-ce|-| radarr||https://github.com/vik-y/amahi_images/tree/master/radarr||https://github.com/linuxserver/docker-compose files of different apps please refer to [radarr|-| hydra||https://github.com/vik-y/amahi_images /tree/master/hydra||https://github.com/linuxserver/docker-hydra|-| logitech-media-server||https://github.com/vik-y/amahi_images repo/tree/master/logitech-media-server||https://github.]com/larsks/docker-image-logitech-media-server|-| markdown-editor||https://github.com/vik-y/amahi_images/tree/master/markdown-editor||https://hub.docker.com/r/v4tech/markdown-editor|-| nzbget||https://github.com/vik-y/amahi_images/tree/master/nzbget||https://github.com/linuxserver/docker-nzbget|-| portainer||https://github.com/vik-y/amahi_images/tree/master/portainer||https://hub.docker.com/r/portainer/portainer/|-| redmine||https://github.com/vik-y/amahi_images/tree/master/redmine||https://hub.docker.com/_/redmine/|-| sinusbot||https://github.com/vik-y/amahi_images/tree/master/sinusbot||https://github.com/vik-y/amahi_images/tree/master/sinusbot|-| sonarr||https://github.com/vik-y/amahi_images/tree/master/sonarr||https://github.com/linuxserver/docker-sonarr|-| squid||https://github.com/vik-y/amahi_images/tree/master/squid||https://hub.docker.com/r/sameersbn/squid|}
==Brief Overview of Code==
12,424

edits