Coder Social home page Coder Social logo

wolnosciowiec-archive / ansible-harbor-role Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 1.0 39 KB

Ansible: Docker-based envrionment deployment

License: Other

Shell 35.15% Python 56.01% HTML 8.84%
ansible ansible-roles anarchist anarchist-federation iwa-ait zsp docker deployment docker-environment systemd

ansible-harbor-role's Introduction

Dockerized Project

Automated deployment of Dockerized environment from GIT which includes:

  • systemd integration
  • production specific .env configuration
  • test server specific .env configuration (when: host equals localhost)
  • Makefile support to manage the project
  • Optionally: Encrypted .env-prod files in project repository, decrypted during deployment

Preliminaries

  1. You need a project at any git server.
  2. The project need to have a Makefile with task "deployment_pre"
  3. Your project need to have an .env file, or .env-template that will be copied into .env

Environment

# user who deploys the application
deploy_user: tech.admin
deploy_group: technical
compose_env_name: "your-docker-compose-environment-name-there"
systemd_service_sleep: 30

project_dir: /project

# change it to sg. "./make.sh" if you have a root-executed entrypoint for given group of users
# do not use sudo here (avoid making sudo in sudo inception)
make_executable: "./make.sh"

# this origin will be set only during deployment time
git_deploy_url: https://user:password@somehost/someuser/somerepo

# without user and password, this form will stay on server
git_regular_deploy_url: https://somehost/someuser/somerepo

# prevents from restarting whole environment when deploying the project over and over again
avoid_whole_environment_restart: yes

#
# Recovery from backup, on first deployment you may want to restore whole environment from backup
# or in case of a failure. Generally this flag should be set manually per-deployment.
#
# Only if you have setup a File Repository instance on external server for backups storage.
#
restore_from_backup_with_recovery_plan: no

# prefer .env-prod (if present in cloned git repository) instead of .env-dist
prefer_env_prod_over_dist: yes

# .env support (also works with .env-prod)
test_specific_env:
    - { line: "DOMAIN_SUFFIX=.localhost", regexp: '^DOMAIN_SUFFIX', title: 'env: Add domain suffix - .localhost' }

production_specific_env:
    - { line: "DOMAIN_SUFFIX=", regexp: '^DOMAIN_SUFFIX', title: 'env: Remove domain suffix' }

Troubleshooting

  1. Provisioning as user X, but running Riotkit's Harbor as user Y

It may be very confusing to the Makefile, who exactly should run non-privileged commands. The solution is to skip user automatic detection, by hardcoding user and group id into the .env file

test_specific_env:
    - { line: "DOMAIN_SUFFIX=.localhost", regexp: '^DOMAIN_SUFFIX', title: 'env: Add domain suffix - .localhost' }
    - { line: "APP_USER=tech.admin", regexp: '^APP_USER', title: 'env: APP_USER' }
    - { line: "APP_GROUP_ID=1800", regexp: '^APP_GROUP_ID', title: 'env: APP_GROUP_ID' }

production_specific_env:
    - { line: "DOMAIN_SUFFIX=", regexp: '^DOMAIN_SUFFIX', title: 'env: Remove domain suffix' }
    - { line: "APP_USER=tech.admin", regexp: '^APP_USER', title: 'env: APP_USER' }
    - { line: "APP_GROUP_ID=1800", regexp: '^APP_GROUP_ID', title: 'env: APP_GROUP_ID' }

ansible-harbor-role's People

Contributors

blackandred avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

blackandred

ansible-harbor-role's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.