Merge branch 'remove-production-node' into 'master'
Remove NodeJS as a production dependency Closes #1874 See merge request !1264
This commit is contained in:
commit
7d22e0a8b7
|
@ -84,7 +84,6 @@ dependency "chef-gem"
|
|||
dependency "remote-syslog" if ee
|
||||
dependency "logrotate"
|
||||
dependency "runit"
|
||||
dependency "nodejs"
|
||||
dependency "gitlab-rails"
|
||||
dependency "gitlab-shell"
|
||||
dependency "gitlab-workhorse"
|
||||
|
|
|
@ -82,21 +82,24 @@ build do
|
|||
# Not using the patch DSL as we need the path to the gems directory
|
||||
command "cat #{patch_file_path} | patch -p1 \"$(#{gemdir_cmd})/gems/gitlab-markup-1.5.1/lib/github/markups.rb\""
|
||||
|
||||
# In order to precompile the assets, we need to get to a state where rake can
|
||||
# In order to compile the assets, we need to get to a state where rake can
|
||||
# load the Rails environment.
|
||||
copy 'config/gitlab.yml.example', 'config/gitlab.yml'
|
||||
copy 'config/database.yml.postgresql', 'config/database.yml'
|
||||
copy 'config/secrets.yml.example', 'config/secrets.yml'
|
||||
|
||||
assets_precompile_env = {
|
||||
assets_compile_env = {
|
||||
"NODE_ENV" => "production",
|
||||
"RAILS_ENV" => "production",
|
||||
"PATH" => "#{install_dir}/embedded/bin:#{ENV['PATH']}",
|
||||
"USE_DB" => "false",
|
||||
"SKIP_STORAGE_VALIDATION" => "true"
|
||||
}
|
||||
bundle "exec rake assets:precompile", :env => assets_precompile_env
|
||||
command "npm install --production"
|
||||
bundle "exec rake gitlab:assets:compile", :env => assets_compile_env
|
||||
|
||||
# Tear down now that the assets:precompile is done.
|
||||
# Tear down now that gitlab:assets:compile is done.
|
||||
delete 'node_modules'
|
||||
delete 'config/gitlab.yml'
|
||||
delete 'config/database.yml'
|
||||
delete 'config/secrets.yml'
|
||||
|
|
|
@ -1,45 +0,0 @@
|
|||
#
|
||||
# Copyright 2013-2014 Chef Software, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
name "nodejs"
|
||||
default_version "0.10.35"
|
||||
|
||||
license "MIT"
|
||||
license_file "LICENSE"
|
||||
|
||||
version "0.10.35" do
|
||||
source md5: "2c00d8cf243753996eecdc4f6e2a2d11"
|
||||
end
|
||||
|
||||
source url: "https://nodejs.org/dist/v#{version}/node-v#{version}.tar.gz"
|
||||
|
||||
relative_path "node-v#{version}"
|
||||
|
||||
build do
|
||||
env = with_standard_compiler_flags(with_embedded_path)
|
||||
|
||||
args = if ohai['kernel']['machine'].start_with?('arm')
|
||||
'--without-snapshot'
|
||||
else
|
||||
''
|
||||
end
|
||||
|
||||
command "python ./configure" \
|
||||
" --prefix=#{install_dir}/embedded #{args}", env: env
|
||||
|
||||
make "-j #{workers}", env: env
|
||||
make "install", env: env
|
||||
end
|
|
@ -147,8 +147,8 @@ shell and the `passwd` command for non-superusers requires entering the current
|
|||
password prior to a new password. The user cannot enter a password that will
|
||||
match `'*'` and therefore the account remains password-less.
|
||||
|
||||
Keep in mind that the git user must have access to the system so please review
|
||||
your security settings at `/etc/security/access.conf` and make sure the git user
|
||||
Keep in mind that the git user must have access to the system so please review
|
||||
your security settings at `/etc/security/access.conf` and make sure the git user
|
||||
is not blocked.
|
||||
|
||||
### Postgres error 'FATAL: could not create shared memory segment: Cannot allocate memory'
|
||||
|
@ -311,9 +311,9 @@ When you install GitLab from source (which was the only way to do it before we
|
|||
had omnibus packages) you need to convert the assets on your GitLab server
|
||||
every time you update GitLab. People used to overlook this step and there are
|
||||
still posts, comments and mails out there on the internet where users recommend
|
||||
each other to run `rake assets:precompile`. With the omnibus packages things
|
||||
are different: when we build the package [we convert the assets for
|
||||
you](https://gitlab.com/gitlab-org/omnibus-gitlab/blob/1cfe925e0c015df7722bb85eddc0b4a3b59c1211/config/software/gitlab-rails.rb#L74).
|
||||
each other to run `rake assets:precompile` (which has now been renamed
|
||||
`gitlab:assets:compile`). With the omnibus packages things are different: when
|
||||
we build the package [we compile the assets for you](https://gitlab.com/gitlab-org/omnibus-gitlab/blob/1cfe925e0c015df7722bb85eddc0b4a3b59c1211/config/software/gitlab-rails.rb#L74).
|
||||
When you install GitLab with an omnibus package, the converted assets are
|
||||
already there! That is why you do not need to run `rake assets:precompile` when
|
||||
you install GitLab from a package.
|
||||
|
@ -327,10 +327,10 @@ If you want to run GitLab with custom JavaScript or CSS code you are probably
|
|||
better off running GitLab from source, or building your own packages.
|
||||
|
||||
If you really know what you are doing,
|
||||
you can execute `gitlab-rake assets:precompile` like this
|
||||
you can execute `gitlab-rake gitlab:assets:compile` like this:
|
||||
|
||||
```shell
|
||||
sudo NO_PRIVILEGE_DROP=true USE_DB=false gitlab-rake assets:clean assets:precompile
|
||||
sudo NO_PRIVILEGE_DROP=true USE_DB=false gitlab-rake gitlab:assets:clean gitlab:assets:compile
|
||||
# user and path might be different if you changed the defaults of
|
||||
# user['username'], user['group'] and gitlab_rails['dir'] in gitlab.rb
|
||||
sudo chown -R git:git /var/opt/gitlab/gitlab-rails/tmp/cache
|
||||
|
|
|
@ -36,11 +36,14 @@ manually edit them in any local repository that points to your GitLab instance.
|
|||
|
||||
### Relative URL requirements
|
||||
|
||||
_Starting with 8.17 packages, there is **no need to recompile assets**._
|
||||
|
||||
The Omnibus GitLab package is shipped with pre-compiled assets (CSS, JavaScript,
|
||||
fonts, etc.). If you configure Omnibus with a relative URL, the assets will
|
||||
need to be recompiled, which is a task which consumes a lot of CPU and memory
|
||||
resources. To avoid out-of-memory errors, you should have at least 2GB of RAM
|
||||
available on your system, while we recommend 4GB RAM, and 4 or 8 CPU cores.
|
||||
fonts, etc.). If you are running a package _prior to 8.17_ and you configure
|
||||
Omnibus with a relative URL, the assets will need to be recompiled, which is a
|
||||
task which consumes a lot of CPU and memory resources. To avoid out-of-memory
|
||||
errors, you should have at least 2GB of RAM available on your system, while we
|
||||
recommend 4GB RAM, and 4 or 8 CPU cores.
|
||||
|
||||
### Enable relative URL in GitLab
|
||||
|
||||
|
@ -93,8 +96,14 @@ If you stumble upon any issues, see the [troubleshooting section]
|
|||
|
||||
### Relative URL troubleshooting
|
||||
|
||||
If for some reason the asset compilation fails (i.e. the server runs out of memory),
|
||||
you can execute the task manually after you addressed the issue (e.g. add swap):
|
||||
If you notice any issues with gitlab assets appearing broken after moving to a
|
||||
relative url configuration (like missing images or unresponsive components)
|
||||
please raise an issue in [GitLab CE](https://gitlab.com/gitlab-org/gitlab-ce)
|
||||
with the `Frontend` label.
|
||||
|
||||
If you are running a version _prior to 8.17_ and for some reason the asset
|
||||
compilation step fails (i.e. the server runs out of memory), you can execute
|
||||
the task manually after you addressed the issue (e.g. add swap):
|
||||
|
||||
```shell
|
||||
sudo NO_PRIVILEGE_DROP=true USE_DB=false gitlab-rake assets:clean assets:precompile
|
||||
|
|
|
@ -66,7 +66,9 @@ default['gitlab']['gitlab-rails']['env'] = {
|
|||
# Charlock Holmes and libicu will report U_FILE_ACCESS_ERROR if this is not set to the right path
|
||||
# See https://gitlab.com/gitlab-org/gitlab-ce/issues/17415#note_13868167
|
||||
'ICU_DATA' => "#{node['package']['install-dir']}/embedded/share/icu/current",
|
||||
'PYTHONPATH' => "#{node['package']['install-dir']}/embedded/lib/python3.4/site-packages"
|
||||
'PYTHONPATH' => "#{node['package']['install-dir']}/embedded/lib/python3.4/site-packages",
|
||||
# Prevent ExecJS from complaining that Node is not installed in production
|
||||
'EXECJS_RUNTIME' => 'Disabled',
|
||||
}
|
||||
default['gitlab']['gitlab-rails']['enable_jemalloc'] = true
|
||||
|
||||
|
|
|
@ -214,7 +214,6 @@ templatesymlink "Create a relative_url.rb and create a symlink to Rails root" do
|
|||
group "root"
|
||||
mode "0644"
|
||||
variables(node['gitlab']['gitlab-rails'].to_hash)
|
||||
notifies [:run, 'bash[generate assets]']
|
||||
restarts dependent_services
|
||||
|
||||
unless node['gitlab']['gitlab-rails']['gitlab_relative_url']
|
||||
|
@ -331,7 +330,6 @@ end
|
|||
# Or migration failed for some reason
|
||||
remote_file File.join(gitlab_rails_dir, 'REVISION') do
|
||||
source "file:///opt/gitlab/embedded/service/gitlab-rails/REVISION"
|
||||
notifies :run, 'bash[generate assets]' if node['gitlab']['gitlab-rails']['gitlab_relative_url']
|
||||
end
|
||||
|
||||
# If a version of ruby changes restart unicorn. If not, unicorn will fail to
|
||||
|
@ -354,20 +352,6 @@ execute "clear the gitlab-rails cache" do
|
|||
action :nothing
|
||||
end
|
||||
|
||||
bash "generate assets" do
|
||||
code <<-EOS
|
||||
set -e
|
||||
/opt/gitlab/bin/gitlab-rake assets:clean assets:precompile
|
||||
chown -R #{gitlab_user}:#{gitlab_group} #{gitlab_rails_tmp_dir}/cache
|
||||
EOS
|
||||
# We have to precompile assets as root because of permissions and ownership of files
|
||||
environment ({ 'NO_PRIVILEGE_DROP' => 'true', 'USE_DB' => 'false' })
|
||||
dependent_services.each do |sv|
|
||||
notifies :restart, sv
|
||||
end
|
||||
action :nothing
|
||||
end
|
||||
|
||||
bitbucket_keys = node['gitlab']['gitlab-rails']['bitbucket']
|
||||
|
||||
unless bitbucket_keys.nil?
|
||||
|
|
Loading…
Reference in New Issue