Voice data server for navigation voice changer app.
Revisión | cc305fbd16292f3b1c209e64ea07a2105fbd9184 (tree) |
---|---|
Tiempo | 2016-10-05 21:32:49 |
Autor | HMML <hmml3939@gmai...> |
Commiter | HMML |
Add docker deploy settings.
@@ -5,8 +5,8 @@ RUN apt -y full-upgrade | ||
5 | 5 | RUN apt -y install file sox libsox-fmt-mp3 libsox-fmt-base |
6 | 6 | RUN apt -y install libsqlite3-dev |
7 | 7 | RUN apt-get clean |
8 | -RUN adduser --system --disabled-password --uid 3000 --group --home /var/local/app rails | |
8 | +RUN adduser --system --disabled-password --uid 3000 --group --home /app rails | |
9 | 9 | RUN gem install bundler --no-rdoc --no-ri |
10 | -USER rails | |
11 | -ENV BUNDLE_APP_CONFIG /var/local/app/.bundle | |
12 | -CMD cd /var/local/app/current && exec bin/rails server | |
10 | +ADD runapp / | |
11 | +ENV BUNDLE_APP_CONFIG /app/.bundle | |
12 | +CMD /runapp |
@@ -1,9 +1,10 @@ | ||
1 | 1 | set :sshkit_backend, SSHKit::Backend::Docker |
2 | 2 | set :stage, :development |
3 | 3 | set :branch, 'master' |
4 | -set :deploy_to, '/var/local/app' | |
4 | +set :deploy_to, '/app' | |
5 | 5 | set :repo_url, '/src' |
6 | -fetch(:default_env).merge!(rails_env: :development, SECRET_KEY_BASE: 'dummy', DEVISE_SECRET_KEY: 'dummy') | |
6 | +fetch(:default_env).merge!(rails_env: :development, RAILS_SERVE_STATIC_FILES: 1, | |
7 | + SECRET_KEY_BASE: 'dummy', DEVISE_SECRET_KEY: 'dummy') | |
7 | 8 | set :bundle_without, 'test' |
8 | 9 | |
9 | 10 | fetch(:linked_dirs, []).clear |
@@ -1,15 +1,18 @@ | ||
1 | 1 | set :sshkit_backend, SSHKit::Backend::Docker |
2 | 2 | set :stage, :development |
3 | 3 | set :branch, 'master' |
4 | -set :deploy_to, '/var/local/app' | |
5 | -fetch(:default_env).merge!(rails_env: :production, SECRET_KEY_BASE: 'dummy', DEVISE_SECRET_KEY: 'dummy') | |
6 | - | |
7 | -fetch(:linked_dirs, []).clear | |
8 | -fetch(:linked_files, []).clear | |
4 | +set :deploy_to, '/app' | |
5 | +fetch(:default_env).merge!(rails_env: :production, RAILS_SERVE_STATIC_FILES: 1, | |
6 | + SECRET_KEY_BASE: 'dummy', DEVISE_SECRET_KEY: 'dummy', | |
7 | + DATABASE_URL: 'mysql2://0/change-this-in-real-production') | |
8 | +#set :linked_dirs, %w() | |
9 | +set :linked_files, %w() | |
10 | +Rake::Task["deploy:set_linked_dirs"].clear # Save assets on each releases dir (not under shared) | |
9 | 11 | |
10 | 12 | server docker: { |
11 | 13 | image: 'nvc-base', |
12 | 14 | commit: 'nvc', |
15 | + env: {RAILS_SERVE_STATIC_FILES: 1}, | |
13 | 16 | }, user: 'rails:rails', roles: %w{web app} |
14 | 17 | |
15 | 18 | Rake::Task["passenger:restart"].clear |
@@ -0,0 +1,19 @@ | ||
1 | +#!/bin/bash | |
2 | +: ${APP_HOME_DIR:=/app} | |
3 | +: ${APP_CURRENT_DIR:=/app/current} | |
4 | +: ${APP_UID:=3000} | |
5 | +: ${APP_GID:=3000} | |
6 | +: ${APP_SERVER_CMD:=exec bin/rails server -b0} | |
7 | + | |
8 | +find "${APP_HOME_DIR}" -xdev -print0 | xargs -r0 chown -h "${RAILS_UID}:${RAILS_GID}" | |
9 | + | |
10 | +if [ "$(id -g rails)" -ne "${APP_GID}" ]; then | |
11 | + groupmod --non-unique --gid "${APP_GID}" rails | |
12 | +fi | |
13 | +if [ "$(id -u rails)" -ne "${APP_UID}" ]; then | |
14 | + usermod --non-unique --uid "${APP_UID}" rails | |
15 | +fi | |
16 | + | |
17 | +rm -f "${APP_CURRENT_DIR}"/tmp/pids/* | |
18 | +cd "${APP_CURRENT_DIR}" | |
19 | +exec su -p -s /bin/bash -c "${APP_SERVER_CMD}" rails |