Skip to content

Instantly share code, notes, and snippets.

@jpic
Created February 14, 2019 03:44
Show Gist options
  • Save jpic/a2248d9f09986e141369d9669efbc842 to your computer and use it in GitHub Desktop.
Save jpic/a2248d9f09986e141369d9669efbc842 to your computer and use it in GitHub Desktop.
ansible-compose
14/02 2019 04:39:23 jpic@jpic ~/src/ansible-compose (master)
$ ansible-compose [email protected]/home/jpic/bar stop
Running ssh [email protected] bash -euxc 'cd /home/jpic/bar; docker-compose stop'
+ cd /home/jpic/bar
+ docker-compose stop
Stopping bar_web_1 ... done
14/02 2019 04:39:48 jpic@jpic ~/src/ansible-compose (master)
$ ansible-compose [email protected]/home/jpic/bar logs
Running ssh [email protected] bash -euxc 'cd /home/jpic/bar; docker-compose logs'
+ cd /home/jpic/bar
+ docker-compose logs
Attaching to bar_web_1
web_1 | + mrs migrate --noinput
web_1 | /app/src/mrs/manage.py:11: UserWarning: DEFAULTING DEBUG=1 FOR mrs COMMAND, that doesnt enable it in wsgi
web_1 | "DEFAULTING DEBUG=1 FOR mrs COMMAND, that doesnt enable it in wsgi"
web_1 | System check identified some issues:
web_1 |
web_1 | WARNINGS:
web_1 | mrsuser.User.caisses: (fields.W340) null has no effect on ManyToManyField.
web_1 | Operations to perform:
web_1 | Apply all migrations: admin, auth, caisse, contenttypes, denorm, djcall, explorer, institution, mrsattachment, mrsemail, mrsrequest, mrsstat, mrsuser, person, sessions
web_1 | Running migrations:
web_1 | Applying contenttypes.0001_initial... OK
web_1 | Applying contenttypes.0002_remove_content_type_name... OK
web_1 | Applying auth.0001_initial... OK
web_1 | Applying auth.0002_alter_permission_name_max_length... OK
web_1 | Applying auth.0003_alter_user_email_max_length... OK
web_1 | Applying auth.0004_alter_user_username_opts... OK
web_1 | Applying auth.0005_alter_user_last_login_null... OK
web_1 | Applying auth.0006_require_contenttypes_0002... OK
web_1 | Applying auth.0007_alter_validators_add_error_messages... OK
web_1 | Applying auth.0008_alter_user_username_max_length... OK
web_1 | Applying auth.0009_alter_user_last_name_max_length... OK
web_1 | Applying mrsuser.0001_initial... OK
web_1 | Applying admin.0001_initial... OK
web_1 | Applying admin.0002_logentry_remove_auto_add... OK
web_1 | Applying admin.0003_logentry_add_action_flag_choices... OK
web_1 | Applying caisse.0001_initial... OK
web_1 | Applying caisse.0002_caisse_meta_option_change... OK
web_1 | Applying caisse.0003_caisse_parking_enable... OK
web_1 | Applying caisse.0004_caisse_import_datetime... OK
web_1 | Applying denorm.0001_initial... OK
web_1 | Applying djcall.0001_initial... OK
web_1 | Applying djcall.0002_caller_signal_number... OK
web_1 | Applying explorer.0001_initial... OK
web_1 | Applying explorer.0002_auto_20150501_1515... OK
web_1 | Applying explorer.0003_query_snapshot... OK
web_1 | Applying explorer.0004_querylog_duration... OK
web_1 | Applying explorer.0005_auto_20160105_2052... OK
web_1 | Applying explorer.0006_query_connection... OK
web_1 | Applying explorer.0007_querylog_connection... OK
web_1 | Applying institution.0001_initial... OK
web_1 | Applying institution.0002_unique_finess... OK
web_1 | Applying mrsattachment.0001_initial... OK
web_1 | Applying mrsemail.0001_initial... OK
web_1 | Applying mrsemail.0002_labels... OK
web_1 | Applying mrsemail.0003_add_emailtemplate_menu... OK
web_1 | Applying mrsemail.0004_add_mrsemail_counter... OK
web_1 | Applying mrsemail.0005_counter... OK
web_1 | Applying person.0001_initial... OK
web_1 | Applying mrsrequest.0001_initial... OK
web_1 | Applying mrsrequest.0002_status_inprogress... OK
web_1 | Applying mrsrequest.0003_mrsrequest_reject_template_set_null... OK
web_1 | Applying mrsrequest.0004_mrsrequest_logentry... OK
web_1 | Applying mrsrequest.0005_stats... OK
web_1 | Applying mrsrequest.0006_display_id_bigint... OK
web_1 | Applying mrsrequest.0007_status_blank... OK
web_1 | Applying mrsrequest.0008_mrsrequest_adeli... OK
web_1 | Applying mrsrequest.0009_delay_saving_taxi_cost... OK
web_1 | Applying mrsrequest.0010_decimal_digits... OK
web_1 | Applying person.0002_insured_shift_move_to_person... OK
web_1 | Applying mrsrequest.0011_insured_shift_move_to_person... OK
web_1 | Applying mrsrequest.0012_mrsrequest_insured_shift... OK
web_1 | Applying mrsrequest.0013_fix_y2k... OK
web_1 | Applying mrsrequest.0014_mrsrequestlogentry... OK
web_1 | Applying mrsrequest.0015_migrate_logentries... OK
web_1 | Applying mrsrequest.0016_instance_data...Not postgres -> no JSON field
web_1 | OK
web_1 | Applying mrsrequest.0017_expense_rename_expensevp... OK
web_1 | Applying mrsrequest.0018_distance_rename_distancevp... OK
web_1 | Applying mrsrequest.0019_add_bill_mode... OK
web_1 | Applying mrsrequest.0020_add_billatp... OK
web_1 | Applying mrsrequest.0021_save_modes... OK
web_1 | Applying mrsrequest.0022_drop_mrsrequest_reject_template_relation... OK
web_1 | Applying mrsrequest.0023_mrsrequest_modevp_default_false... OK
web_1 | Applying mrsrequest.0024_nonschematic_options... OK
web_1 | Applying mrsrequest.0025_initial_data_distancevp... OK
web_1 | Applying mrsrequest.0026_rename_mandate_date_mandate_datevp... OK
web_1 | Applying mrsrequest.0027_add_mrsrequest_mandate_dateatp... OK
web_1 | Applying mrsrequest.0028_initial_data_distancevp... OK
web_1 | Applying mrsrequest.0029_convert_birth_dates_to_fr_format... OK
web_1 | Applying mrsrequest.0030_add_mrsrequest_confirms... OK
web_1 | Applying mrsrequest.0031_null_expense_fields... OK
web_1 | Applying mrsrequest.0032_remove_mrsrequest_creation_ip... OK
web_1 | Applying mrsrequest.0033_conflicts_counter_rewrite... OK
web_1 | Applying mrsrequest.0034_mrsrequest_token... OK
web_1 | Applying mrsrequest.0035_cancel_mrsrequest... OK
web_1 | Applying mrsstat.0001_initial... OK
web_1 | Applying mrsstat.0002_labels_and_decimal_digits... OK
web_1 | Applying mrsstat.0003_update...Creating missing stats now ...
web_1 | OK
web_1 | Applying mrsstat.0004_change_denorm... OK
web_1 | Applying mrsstat.0005_stat_insured_shifts... OK
web_1 | Applying mrsstat.0006_stat_mrsrequest_count_inprogress... OK
web_1 | Applying mrsstat.0007_totals... OK
web_1 | Applying mrsuser.0002_user_caisses... OK
web_1 | Applying mrsuser.0003_meta... OK
web_1 | Applying mrsuser.0004_user_profile... OK
web_1 | Applying mrsuser.0005_nonschematic_options... OK
web_1 | Applying mrsuser.0006_add_is_superuser... OK
web_1 | Applying person.0003_fix_y2k... OK
web_1 | Applying person.0004_auto_20181029_1134... OK
web_1 | Applying person.0005_person_use_email... OK
web_1 | Applying person.0006_person_confirms... OK
web_1 | Applying person.0007_nir_charfield... OK
web_1 | Applying person.0008_conflicts_counter_rewrite... OK
web_1 | Applying sessions.0001_initial... OK
web_1 | + uwsgi --spooler=/app/spooler/mail --spooler=/app/spooler/stat --spooler-processes 8 --socket=0.0.0.0:6789 --chdir=/app --plugin=python3,http,router_static,router_cache --module=mrs.wsgi:application --http-keepalive --harakiri=120 --max-requests=100 --master --workers=24 --processes=12 --chmod=666 --log-5xx --vacuum --enable-threads --reload-os-env --post-buffering=8192 --ignore-sigpipe --ignore-write-errors --disable-write-exception --mime-file /etc/mime.types --thunder-lock --offload-threads %k --file-serve-mode x-accel-redirect --route '^/static/.* addheader:Cache-Control: public, max-age=7776000' --static-map /app/static=/static/ --static-gzip-all --cache2 name=statcalls,items=100 --static-cache-paths 86400 --static-cache-paths-name statcalls
web_1 | [spooler directory] access(): File exists [core/spooler.c line 26]
web_1 | + mrs migrate --noinput
web_1 | /app/src/mrs/manage.py:11: UserWarning: DEFAULTING DEBUG=1 FOR mrs COMMAND, that doesnt enable it in wsgi
web_1 | "DEFAULTING DEBUG=1 FOR mrs COMMAND, that doesnt enable it in wsgi"
web_1 | System check identified some issues:
web_1 |
web_1 | WARNINGS:
web_1 | mrsuser.User.caisses: (fields.W340) null has no effect on ManyToManyField.
web_1 | Operations to perform:
web_1 | Apply all migrations: admin, auth, caisse, contenttypes, denorm, djcall, explorer, institution, mrsattachment, mrsemail, mrsrequest, mrsstat, mrsuser, person, sessions
web_1 | Running migrations:
web_1 | No migrations to apply.
web_1 | Your models have changes that are not yet reflected in a migration, and so won't be applied.
web_1 | Run 'manage.py makemigrations' to make new migrations, and then re-run 'manage.py migrate' to apply them.
web_1 | + uwsgi --spooler=/app/spooler/mail --spooler=/app/spooler/stat --spooler-processes 8 --socket=0.0.0.0:6789 --chdir=/app --plugin=python3,http,router_static,router_cache --module=mrs.wsgi:application --http-keepalive --harakiri=120 --max-requests=100 --master --workers=24 --processes=12 --chmod=666 --log-5xx --vacuum --enable-threads --reload-os-env --post-buffering=8192 --ignore-sigpipe --ignore-write-errors --disable-write-exception --mime-file /etc/mime.types --thunder-lock --offload-threads %k --file-serve-mode x-accel-redirect --route '^/static/.* addheader:Cache-Control: public, max-age=7776000' --static-map /app/static=/static/ --static-gzip-all --cache2 name=statcalls,items=100 --static-cache-paths 86400 --static-cache-paths-name statcalls
web_1 | [spooler directory] access(): File exists [core/spooler.c line 26]
web_1 | + mrs migrate --noinput
web_1 | /app/src/mrs/manage.py:11: UserWarning: DEFAULTING DEBUG=1 FOR mrs COMMAND, that doesnt enable it in wsgi
web_1 | "DEFAULTING DEBUG=1 FOR mrs COMMAND, that doesnt enable it in wsgi"
web_1 | System check identified some issues:
web_1 |
web_1 | WARNINGS:
web_1 | mrsuser.User.caisses: (fields.W340) null has no effect on ManyToManyField.
web_1 | Operations to perform:
web_1 | Apply all migrations: admin, auth, caisse, contenttypes, denorm, djcall, explorer, institution, mrsattachment, mrsemail, mrsrequest, mrsstat, mrsuser, person, sessions
web_1 | Running migrations:
web_1 | No migrations to apply.
web_1 | Your models have changes that are not yet reflected in a migration, and so won't be applied.
web_1 | Run 'manage.py makemigrations' to make new migrations, and then re-run 'manage.py migrate' to apply them.
web_1 | + uwsgi --spooler=/app/spooler/mail --spooler=/app/spooler/stat --spooler-processes 8 --socket=0.0.0.0:6789 --chdir=/app --plugin=python3,http,router_static,router_cache --module=mrs.wsgi:application --http-keepalive --harakiri=120 --max-requests=100 --master --workers=24 --processes=12 --chmod=666 --log-5xx --vacuum --enable-threads --reload-os-env --post-buffering=8192 --ignore-sigpipe --ignore-write-errors --disable-write-exception --mime-file /etc/mime.types --thunder-lock --offload-threads %k --file-serve-mode x-accel-redirect --route '^/static/.* addheader:Cache-Control: public, max-age=7776000' --static-map /app/static=/static/ --static-gzip-all --cache2 name=statcalls,items=100 --static-cache-paths 86400 --static-cache-paths-name statcalls
web_1 | [spooler directory] access(): File exists [core/spooler.c line 26]
web_1 | + mrs migrate --noinput
web_1 | /app/src/mrs/manage.py:11: UserWarning: DEFAULTING DEBUG=1 FOR mrs COMMAND, that doesnt enable it in wsgi
web_1 | "DEFAULTING DEBUG=1 FOR mrs COMMAND, that doesnt enable it in wsgi"
web_1 | System check identified some issues:
web_1 |
web_1 | WARNINGS:
web_1 | mrsuser.User.caisses: (fields.W340) null has no effect on ManyToManyField.
web_1 | Operations to perform:
web_1 | Apply all migrations: admin, auth, caisse, contenttypes, denorm, djcall, explorer, institution, mrsattachment, mrsemail, mrsrequest, mrsstat, mrsuser, person, sessions
web_1 | Running migrations:
web_1 | No migrations to apply.
web_1 | Your models have changes that are not yet reflected in a migration, and so won't be applied.
web_1 | Run 'manage.py makemigrations' to make new migrations, and then re-run 'manage.py migrate' to apply them.
web_1 | + uwsgi --spooler=/app/spooler/mail --spooler=/app/spooler/stat --spooler-processes 8 --socket=0.0.0.0:6789 --chdir=/app --plugin=python3,http,router_static,router_cache --module=mrs.wsgi:application --http-keepalive --harakiri=120 --max-requests=100 --master --workers=24 --processes=12 --chmod=666 --log-5xx --vacuum --enable-threads --reload-os-env --post-buffering=8192 --ignore-sigpipe --ignore-write-errors --disable-write-exception --mime-file /etc/mime.types --thunder-lock --offload-threads %k --file-serve-mode x-accel-redirect --route '^/static/.* addheader:Cache-Control: public, max-age=7776000' --static-map /app/static=/static/ --static-gzip-all --cache2 name=statcalls,items=100 --static-cache-paths 86400 --static-cache-paths-name statcalls
web_1 | [spooler directory] access(): File exists [core/spooler.c line 26]
web_1 | + mrs migrate --noinput
web_1 | /app/src/mrs/manage.py:11: UserWarning: DEFAULTING DEBUG=1 FOR mrs COMMAND, that doesnt enable it in wsgi
web_1 | "DEFAULTING DEBUG=1 FOR mrs COMMAND, that doesnt enable it in wsgi"
web_1 | System check identified some issues:
web_1 |
web_1 | WARNINGS:
web_1 | mrsuser.User.caisses: (fields.W340) null has no effect on ManyToManyField.
web_1 | Operations to perform:
web_1 | Apply all migrations: admin, auth, caisse, contenttypes, denorm, djcall, explorer, institution, mrsattachment, mrsemail, mrsrequest, mrsstat, mrsuser, person, sessions
web_1 | Running migrations:
web_1 | No migrations to apply.
web_1 | Your models have changes that are not yet reflected in a migration, and so won't be applied.
web_1 | Run 'manage.py makemigrations' to make new migrations, and then re-run 'manage.py migrate' to apply them.
web_1 | + uwsgi --spooler=/app/spooler/mail --spooler=/app/spooler/stat --spooler-processes 8 --socket=0.0.0.0:6789 --chdir=/app --plugin=python3,http,router_static,router_cache --module=mrs.wsgi:application --http-keepalive --harakiri=120 --max-requests=100 --master --workers=24 --processes=12 --chmod=666 --log-5xx --vacuum --enable-threads --reload-os-env --post-buffering=8192 --ignore-sigpipe --ignore-write-errors --disable-write-exception --mime-file /etc/mime.types --thunder-lock --offload-threads %k --file-serve-mode x-accel-redirect --route '^/static/.* addheader:Cache-Control: public, max-age=7776000' --static-map /app/static=/static/ --static-gzip-all --cache2 name=statcalls,items=100 --static-cache-paths 86400 --static-cache-paths-name statcalls
web_1 | [spooler directory] access(): File exists [core/spooler.c line 26]
web_1 | + mrs migrate --noinput
14/02 2019 04:39:52 jpic@jpic ~/src/ansible-compose (master)
$ ansible-compose [email protected]/home/jpic/bar ./docker-compose-example.yml -vv
ansible-playbook -vv --inventory=ci.yourlabs.io, -e path=/home/jpic/bar --user=jpic -e services='{"web": {"image": "${IMAGE-betagouv/mrs:master}", "restart": "unless-stopped"}}' -e compose=/home/jpic/src/ansible-compose/ansible-compose.yml /home/jpic/src/ansible-compose/ansible_compose/playbook.yml
ansible-playbook 2.7.6 (devel 1594ccf533) last updated 2019/01/25 21:56:36 (GMT +200)
config file = None
configured module search path = ['/home/jpic/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /home/jpic/src/ansible/lib/ansible
executable location = /home/jpic/.local/bin/ansible-playbook
python version = 3.7.2 (default, Jan 10 2019, 23:51:51) [GCC 8.2.1 20181127]
No config file found; using defaults
PLAYBOOK: playbook.yml ***********************************************************************************************************
1 plays in /home/jpic/src/ansible-compose/ansible_compose/playbook.yml
PLAY [*] *************************************************************************************************************************
TASK [Gathering Facts] ***********************************************************************************************************
task path: /home/jpic/src/ansible-compose/ansible_compose/playbook.yml:3
ok: [ci.yourlabs.io]
META: ran handlers
TASK [Create home directory] *****************************************************************************************************
task path: /home/jpic/src/ansible-compose/ansible_compose/playbook.yml:8
ok: [ci.yourlabs.io] => {
"changed": false,
"gid": 1000,
"group": "jpic",
"mode": "0775",
"owner": "jpic",
"path": "/home/jpic/bar",
"size": 4096,
"state": "directory",
"uid": 1000
}
TASK [Upload new docker-compose file at destination path] ************************************************************************
task path: /home/jpic/src/ansible-compose/ansible_compose/playbook.yml:12
ok: [ci.yourlabs.io] => {
"changed": false,
"checksum": "891cc99ce3cf4417aadbf3daa78aedc15b66dde0",
"dest": "/home/jpic/bar/docker-compose.yml",
"gid": 1000,
"group": "jpic",
"mode": "0664",
"owner": "jpic",
"path": "/home/jpic/bar/docker-compose.yml",
"size": 97,
"state": "file",
"uid": 1000
}
TASK [Any .env file to upload ?] *************************************************************************************************
task path: /home/jpic/src/ansible-compose/ansible_compose/playbook.yml:18
ok: [ci.yourlabs.io -> localhost] => {
"changed": false,
"stat": {
"exists": false
}
}
TASK [Upload .env file if any] ***************************************************************************************************
task path: /home/jpic/src/ansible-compose/ansible_compose/playbook.yml:24
skipping: [ci.yourlabs.io] => {
"changed": false,
"skip_reason": "Conditional result was False"
}
TASK [docker-compose pull] *******************************************************************************************************
task path: /home/jpic/src/ansible-compose/ansible_compose/playbook.yml:31
changed: [ci.yourlabs.io] => {
"ansible_job_id": "945791501369.16771",
"changed": true,
"finished": 0,
"results_file": "/home/jpic/.ansible_async/945791501369.16771",
"started": 1
}
TASK [Create filesystem directories for each service] ****************************************************************************
task path: /home/jpic/src/ansible-compose/ansible_compose/playbook.yml:41
ok: [ci.yourlabs.io] => {
"changed": false
}
TASK [Compose wait for pull complete] ********************************************************************************************
task path: /home/jpic/src/ansible-compose/ansible_compose/playbook.yml:44
changed: [ci.yourlabs.io] => {
"ansible_job_id": "945791501369.16771",
"attempts": 1,
"changed": true,
"cmd": "docker-compose pull",
"delta": "0:00:01.644695",
"end": "2019-02-14 04:43:29.505628",
"finished": 1,
"rc": 0,
"start": "2019-02-14 04:43:27.860933"
}
STDERR:
Pulling web ... done
TASK [Restart compose services] **************************************************************************************************
task path: /home/jpic/src/ansible-compose/ansible_compose/playbook.yml:51
changed: [ci.yourlabs.io] => {
"changed": true,
"cmd": "docker-compose stop\n docker-compose up -d --remove-orphans",
"delta": "0:00:01.821797",
"end": "2019-02-14 04:43:35.027897",
"rc": 0,
"start": "2019-02-14 04:43:33.206100"
}
STDERR:
Starting bar_web_1 ... done
META: ran handlers
META: ran handlers
PLAY RECAP ***********************************************************************************************************************
ci.yourlabs.io : ok=8 changed=3 unreachable=0 failed=0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment