@@ -0,0 +1,55 | |||||
|
1 | ||||
|
2 | ============================== | |||
|
3 | Generate the Nix expressions | |||
|
4 | ============================== | |||
|
5 | ||||
|
6 | Details can be found in the repository of `RhodeCode Enterprise CE`_ inside of | |||
|
7 | the file `docs/contributing/dependencies.rst`. | |||
|
8 | ||||
|
9 | Start the environment as follows: | |||
|
10 | ||||
|
11 | .. code:: shell | |||
|
12 | ||||
|
13 | nix-shell pkgs/shell-generate.nix | |||
|
14 | ||||
|
15 | ||||
|
16 | ||||
|
17 | Python dependencies | |||
|
18 | =================== | |||
|
19 | ||||
|
20 | .. code:: shell | |||
|
21 | ||||
|
22 | pip2nix generate --licenses | |||
|
23 | # or | |||
|
24 | nix-shell pkgs/shell-generate.nix --command "pip2nix generate --licenses" | |||
|
25 | ||||
|
26 | ||||
|
27 | NodeJS dependencies | |||
|
28 | =================== | |||
|
29 | ||||
|
30 | .. code:: shell | |||
|
31 | ||||
|
32 | # switch to pkgs dir | |||
|
33 | pushd pkgs | |||
|
34 | node2nix --input ../package.json \ | |||
|
35 | -o node-packages.nix \ | |||
|
36 | -e node-env.nix \ | |||
|
37 | -c node-default.nix \ | |||
|
38 | -d --flatten --nodejs-6 | |||
|
39 | popd | |||
|
40 | ||||
|
41 | ||||
|
42 | ||||
|
43 | Bower dependencies | |||
|
44 | ================== | |||
|
45 | ||||
|
46 | .. code:: shell | |||
|
47 | ||||
|
48 | bower2nix bower.json pkgs/bower-packages.nix | |||
|
49 | # or | |||
|
50 | nix-shell pkgs/shell-generate.nix --command "bower2nix bower.json pkgs/bower-packages.nix" | |||
|
51 | ||||
|
52 | ||||
|
53 | .. Links | |||
|
54 | ||||
|
55 | .. _RhodeCode Enterprise CE: https://code.rhodecode.com/rhodecode-enterprise-ce |
@@ -0,0 +1,17 | |||||
|
1 | { pkgs | |||
|
2 | , pythonPackages | |||
|
3 | }: | |||
|
4 | ||||
|
5 | rec { | |||
|
6 | pip2nix-src = pkgs.fetchzip { | |||
|
7 | url = https://github.com/johbo/pip2nix/archive/51e6fdae34d0e8ded9efeef7a8601730249687a6.tar.gz; | |||
|
8 | sha256 = "02a4jjgi7lsvf8mhrxsd56s9a3yg20081rl9bgc2m84w60v2gbz2"; | |||
|
9 | }; | |||
|
10 | ||||
|
11 | pip2nix = import pip2nix-src { | |||
|
12 | inherit | |||
|
13 | pkgs | |||
|
14 | pythonPackages; | |||
|
15 | }; | |||
|
16 | ||||
|
17 | } |
@@ -0,0 +1,52 | |||||
|
1 | { pkgs ? (import <nixpkgs> {}) | |||
|
2 | , pythonPackages ? "python27Packages" | |||
|
3 | }: | |||
|
4 | ||||
|
5 | with pkgs.lib; | |||
|
6 | ||||
|
7 | let _pythonPackages = pythonPackages; in | |||
|
8 | let | |||
|
9 | pythonPackages = getAttr _pythonPackages pkgs; | |||
|
10 | ||||
|
11 | pip2nix = import ./nix-common/pip2nix.nix { | |||
|
12 | inherit | |||
|
13 | pkgs | |||
|
14 | pythonPackages; | |||
|
15 | }; | |||
|
16 | ||||
|
17 | in | |||
|
18 | ||||
|
19 | pkgs.stdenv.mkDerivation { | |||
|
20 | name = "pip2nix-generated"; | |||
|
21 | buildInputs = [ | |||
|
22 | # Allows to generate python packages | |||
|
23 | pip2nix.pip2nix | |||
|
24 | pythonPackages.pip-tools | |||
|
25 | ||||
|
26 | # Allows to generate bower dependencies | |||
|
27 | pkgs.nodePackages.bower2nix | |||
|
28 | ||||
|
29 | # Allows to generate node dependencies | |||
|
30 | pkgs.nodePackages.node2nix | |||
|
31 | ||||
|
32 | # We need mysql_config to be around | |||
|
33 | pkgs.mysql | |||
|
34 | ||||
|
35 | # We need postgresql to be around | |||
|
36 | pkgs.postgresql | |||
|
37 | ||||
|
38 | # Curl is needed for pycurl | |||
|
39 | pkgs.curl | |||
|
40 | ]; | |||
|
41 | ||||
|
42 | shellHook = '' | |||
|
43 | runHook preShellHook | |||
|
44 | runHook postShellHook | |||
|
45 | ''; | |||
|
46 | ||||
|
47 | preShellHook = '' | |||
|
48 | echo "Starting Generate Shell" | |||
|
49 | # Custom prompt to distinguish from other dev envs. | |||
|
50 | export PS1="\n\[\033[1;32m\][Generate-shell:\w]$\[\033[0m\] " | |||
|
51 | ''; | |||
|
52 | } |
@@ -1,17 +1,17 | |||||
1 | { |
|
1 | { | |
2 | "name": "rhodecode-elements", |
|
2 | "name": "rhodecode-elements", | |
3 | "description": "User interface for elements for rhodecode", |
|
3 | "description": "User interface for elements for rhodecode", | |
4 | "main": "index.html", |
|
4 | "main": "index.html", | |
5 | "dependencies": { |
|
5 | "dependencies": { | |
6 | "webcomponentsjs": "^0.7.22", |
|
6 | "webcomponentsjs": "^0.7.22", | |
7 | "polymer": "Polymer/polymer#^1.6.1", |
|
7 | "polymer": "Polymer/polymer#^1.6.1", | |
8 | "paper-button": "PolymerElements/paper-button#^1.0.13", |
|
8 | "paper-button": "PolymerElements/paper-button#^1.0.13", | |
9 | "paper-spinner": "PolymerElements/paper-spinner#^1.2.0", |
|
9 | "paper-spinner": "PolymerElements/paper-spinner#^1.2.0", | |
10 | "paper-tooltip": "PolymerElements/paper-tooltip#^1.1.2", |
|
10 | "paper-tooltip": "PolymerElements/paper-tooltip#^1.1.2", | |
11 | "paper-toast": "PolymerElements/paper-toast#^1.3.0", |
|
11 | "paper-toast": "PolymerElements/paper-toast#^1.3.0", | |
12 | "paper-toggle-button": "PolymerElements/paper-toggle-button#^1.2.0", |
|
12 | "paper-toggle-button": "PolymerElements/paper-toggle-button#^1.2.0", | |
13 |
"iron-ajax": "PolymerElements/iron-ajax#^1.4. |
|
13 | "iron-ajax": "PolymerElements/iron-ajax#^1.4.4", | |
14 | "iron-autogrow-textarea": "PolymerElements/iron-autogrow-textarea#^1.0.13", |
|
14 | "iron-autogrow-textarea": "PolymerElements/iron-autogrow-textarea#^1.0.13", | |
15 | "iron-a11y-keys": "PolymerElements/iron-a11y-keys#^1.0.6" |
|
15 | "iron-a11y-keys": "PolymerElements/iron-a11y-keys#^1.0.6" | |
16 | } |
|
16 | } | |
17 | } |
|
17 | } |
@@ -1,243 +1,258 | |||||
1 | # Nix environment for the community edition |
|
1 | # Nix environment for the community edition | |
2 | # |
|
2 | # | |
3 |
# This shall be as lean as possible, just producing the |
|
3 | # This shall be as lean as possible, just producing the enterprise-ce | |
4 | # derivation. For advanced tweaks to pimp up the development environment we use |
|
4 | # derivation. For advanced tweaks to pimp up the development environment we use | |
5 | # "shell.nix" so that it does not have to clutter this file. |
|
5 | # "shell.nix" so that it does not have to clutter this file. | |
|
6 | # | |||
|
7 | # Configuration, set values in "~/.nixpkgs/config.nix". | |||
|
8 | # example | |||
|
9 | # { | |||
|
10 | # # Thoughts on how to configure the dev environment | |||
|
11 | # rc = { | |||
|
12 | # codeInternalUrl = "https://usr:token@internal-code.rhodecode.com"; | |||
|
13 | # sources = { | |||
|
14 | # rhodecode-vcsserver = "/home/user/work/rhodecode-vcsserver"; | |||
|
15 | # rhodecode-enterprise-ce = "/home/user/work/rhodecode-enterprise-ce"; | |||
|
16 | # rhodecode-enterprise-ee = "/home/user/work/rhodecode-enterprise-ee"; | |||
|
17 | # }; | |||
|
18 | # }; | |||
|
19 | # } | |||
6 |
|
20 | |||
7 | args@ |
|
21 | args@ | |
8 | { pythonPackages ? "python27Packages" |
|
22 | { pythonPackages ? "python27Packages" | |
9 | , pythonExternalOverrides ? self: super: {} |
|
23 | , pythonExternalOverrides ? self: super: {} | |
10 |
, doCheck ? |
|
24 | , doCheck ? false | |
11 | , ... |
|
25 | , ... | |
12 | }: |
|
26 | }: | |
13 |
|
27 | |||
14 | let |
|
28 | let | |
15 |
|
||||
16 | # Use nixpkgs from args or import them. We use this indirect approach |
|
29 | # Use nixpkgs from args or import them. We use this indirect approach | |
17 | # through args to be able to use the name `pkgs` for our customized packages. |
|
30 | # through args to be able to use the name `pkgs` for our customized packages. | |
18 | # Otherwise we will end up with an infinite recursion. |
|
31 | # Otherwise we will end up with an infinite recursion. | |
19 |
|
|
32 | pkgs = args.pkgs or (import <nixpkgs> { }); | |
20 |
|
33 | |||
21 | # johbo: Interim bridge which allows us to build with the upcoming |
|
34 | # Works with the new python-packages, still can fallback to the old | |
22 | # nixos.16.09 branch (unstable at the moment of writing this note) and the |
|
35 | # variant. | |
23 | # current stable nixos-16.03. |
|
36 | basePythonPackagesUnfix = basePythonPackages.__unfix__ or ( | |
24 | backwardsCompatibleFetchgit = { ... }@args: |
|
37 | self: basePythonPackages.override (a: { inherit self; })); | |
25 | let |
|
|||
26 | origSources = nixpkgs.fetchgit args; |
|
|||
27 | in |
|
|||
28 | nixpkgs.lib.overrideDerivation origSources (oldAttrs: { |
|
|||
29 | NIX_PREFETCH_GIT_CHECKOUT_HOOK = '' |
|
|||
30 | find $out -name '.git*' -print0 | xargs -0 rm -rf |
|
|||
31 | ''; |
|
|||
32 | }); |
|
|||
33 |
|
||||
34 | # Create a customized version of nixpkgs which should be used throughout the |
|
|||
35 | # rest of this file. |
|
|||
36 | pkgs = nixpkgs.overridePackages (self: super: { |
|
|||
37 | fetchgit = backwardsCompatibleFetchgit; |
|
|||
38 | }); |
|
|||
39 |
|
38 | |||
40 | # Evaluates to the last segment of a file system path. |
|
39 | # Evaluates to the last segment of a file system path. | |
41 | basename = path: with pkgs.lib; last (splitString "/" path); |
|
40 | basename = path: with pkgs.lib; last (splitString "/" path); | |
42 |
|
41 | |||
43 | # source code filter used as arugment to builtins.filterSource. |
|
42 | # source code filter used as arugment to builtins.filterSource. | |
44 | src-filter = path: type: with pkgs.lib; |
|
43 | src-filter = path: type: with pkgs.lib; | |
45 | let |
|
44 | let | |
46 | ext = last (splitString "." path); |
|
45 | ext = last (splitString "." path); | |
47 | in |
|
46 | in | |
48 | !builtins.elem (basename path) [ |
|
47 | !builtins.elem (basename path) [ | |
49 | ".git" ".hg" "__pycache__" ".eggs" |
|
48 | ".git" ".hg" "__pycache__" ".eggs" ".idea" ".dev" | |
50 | "bower_components" "node_modules" |
|
49 | "bower_components" "node_modules" | |
51 | "build" "data" "result" "tmp"] && |
|
50 | "build" "data" "result" "tmp"] && | |
52 | !builtins.elem ext ["egg-info" "pyc"] && |
|
51 | !builtins.elem ext ["egg-info" "pyc"] && | |
53 | # TODO: johbo: This check is wrong, since "path" contains an absolute path, |
|
52 | # TODO: johbo: This check is wrong, since "path" contains an absolute path, | |
54 | # it would still be good to restore it since we want to ignore "result-*". |
|
53 | # it would still be good to restore it since we want to ignore "result-*". | |
55 | !hasPrefix "result" path; |
|
54 | !hasPrefix "result" path; | |
56 |
|
55 | |||
57 | basePythonPackages = with builtins; if isAttrs pythonPackages |
|
56 | sources = | |
58 | then pythonPackages |
|
57 | let | |
59 | else getAttr pythonPackages pkgs; |
|
58 | inherit (pkgs.lib) all isString attrValues; | |
|
59 | sourcesConfig = pkgs.config.rc.sources or {}; | |||
|
60 | in | |||
|
61 | # Ensure that sources are configured as strings. Using a path | |||
|
62 | # would result in a copy into the nix store. | |||
|
63 | assert all isString (attrValues sourcesConfig); | |||
|
64 | sourcesConfig; | |||
60 |
|
65 | |||
61 | buildBowerComponents = |
|
66 | version = builtins.readFile "${rhodecode-enterprise-ce-src}/rhodecode/VERSION"; | |
62 | pkgs.buildBowerComponents or |
|
|||
63 | (import ./pkgs/backport-16.03-build-bower-components.nix { inherit pkgs; }); |
|
|||
64 |
|
||||
65 | sources = pkgs.config.rc.sources or {}; |
|
|||
66 | version = builtins.readFile ./rhodecode/VERSION; |
|
|||
67 | rhodecode-enterprise-ce-src = builtins.filterSource src-filter ./.; |
|
67 | rhodecode-enterprise-ce-src = builtins.filterSource src-filter ./.; | |
68 |
|
68 | |||
|
69 | buildBowerComponents = pkgs.buildBowerComponents; | |||
69 | nodeEnv = import ./pkgs/node-default.nix { |
|
70 | nodeEnv = import ./pkgs/node-default.nix { | |
70 | inherit pkgs; |
|
71 | inherit pkgs; | |
71 | }; |
|
72 | }; | |
72 | nodeDependencies = nodeEnv.shell.nodeDependencies; |
|
73 | nodeDependencies = nodeEnv.shell.nodeDependencies; | |
73 |
|
74 | |||
74 | bowerComponents = buildBowerComponents { |
|
75 | bowerComponents = buildBowerComponents { | |
75 | name = "enterprise-ce-${version}"; |
|
76 | name = "enterprise-ce-${version}"; | |
76 | generated = ./pkgs/bower-packages.nix; |
|
77 | generated = ./pkgs/bower-packages.nix; | |
77 | src = rhodecode-enterprise-ce-src; |
|
78 | src = rhodecode-enterprise-ce-src; | |
78 | }; |
|
79 | }; | |
79 |
|
80 | |||
80 | pythonGeneratedPackages = self: basePythonPackages.override (a: { |
|
81 | rhodecode-testdata-src = sources.rhodecode-testdata or ( | |
81 | inherit self; |
|
82 | pkgs.fetchhg { | |
82 | }) |
|
83 | url = "https://code.rhodecode.com/upstream/rc_testdata"; | |
83 | // (scopedImport { |
|
84 | rev = "v0.10.0"; | |
84 | self = self; |
|
85 | sha256 = "0zn9swwvx4vgw4qn8q3ri26vvzgrxn15x6xnjrysi1bwmz01qjl0"; | |
85 | super = basePythonPackages; |
|
86 | }); | |
86 | inherit pkgs; |
|
|||
87 | inherit (pkgs) fetchurl fetchgit; |
|
|||
88 | } ./pkgs/python-packages.nix); |
|
|||
89 |
|
87 | |||
90 | pythonOverrides = import ./pkgs/python-packages-overrides.nix { |
|
88 | rhodecode-testdata = import "${rhodecode-testdata-src}/default.nix" { | |
91 |
|
|
89 | inherit | |
92 | basePythonPackages |
|
90 | doCheck | |
93 |
|
|
91 | pkgs | |
|
92 | pythonPackages; | |||
94 | }; |
|
93 | }; | |
95 |
|
94 | |||
96 | pythonLocalOverrides = self: super: { |
|
95 | pythonLocalOverrides = self: super: { | |
97 | rhodecode-enterprise-ce = |
|
96 | rhodecode-enterprise-ce = | |
98 | let |
|
97 | let | |
99 | linkNodeAndBowerPackages = '' |
|
98 | linkNodeAndBowerPackages = '' | |
100 | echo "Export RhodeCode CE path" |
|
|||
101 | export RHODECODE_CE_PATH=${rhodecode-enterprise-ce-src} |
|
99 | export RHODECODE_CE_PATH=${rhodecode-enterprise-ce-src} | |
102 | echo "Link node packages" |
|
100 | ||
|
101 | echo "[BEGIN]: Link node packages" | |||
103 | rm -fr node_modules |
|
102 | rm -fr node_modules | |
104 | mkdir node_modules |
|
103 | mkdir node_modules | |
105 | # johbo: Linking individual packages allows us to run "npm install" |
|
104 | # johbo: Linking individual packages allows us to run "npm install" | |
106 | # inside of a shell to try things out. Re-entering the shell will |
|
105 | # inside of a shell to try things out. Re-entering the shell will | |
107 | # restore a clean environment. |
|
106 | # restore a clean environment. | |
108 | ln -s ${nodeDependencies}/lib/node_modules/* node_modules/ |
|
107 | ln -s ${nodeDependencies}/lib/node_modules/* node_modules/ | |
|
108 | echo "[DONE]: Link node packages" | |||
109 |
|
109 | |||
110 |
echo " |
|
110 | echo "[BEGIN]: Link bower packages" | |
111 |
|
||||
112 | echo "Link bower packages" |
|
|||
113 | rm -fr bower_components |
|
111 | rm -fr bower_components | |
114 | mkdir bower_components |
|
112 | mkdir bower_components | |
|
113 | ln -s ${bowerComponents}/bower_components/* bower_components/ | |||
|
114 | echo "[DONE]: Link bower packages" | |||
|
115 | ''; | |||
115 |
|
|
116 | ||
116 | ln -s ${bowerComponents}/bower_components/* bower_components/ |
|
117 | releaseName = "RhodeCodeEnterpriseCE-${version}"; | |
117 | echo "DONE: Link bower packages" |
|
|||
118 | ''; |
|
|||
119 | in super.rhodecode-enterprise-ce.override (attrs: { |
|
118 | in super.rhodecode-enterprise-ce.override (attrs: { | |
120 |
|
||||
121 | inherit |
|
119 | inherit | |
122 | doCheck |
|
120 | doCheck | |
123 | version; |
|
121 | version; | |
|
122 | ||||
124 | name = "rhodecode-enterprise-ce-${version}"; |
|
123 | name = "rhodecode-enterprise-ce-${version}"; | |
125 | releaseName = "RhodeCodeEnterpriseCE-${version}"; |
|
124 | releaseName = releaseName; | |
126 | src = rhodecode-enterprise-ce-src; |
|
125 | src = rhodecode-enterprise-ce-src; | |
127 | dontStrip = true; # prevent strip, we don't need it. |
|
126 | dontStrip = true; # prevent strip, we don't need it. | |
128 |
|
127 | |||
129 | buildInputs = |
|
128 | # expose following attributed outside | |
130 | attrs.buildInputs ++ |
|
|||
131 | (with self; [ |
|
|||
132 | pkgs.nodePackages.bower |
|
|||
133 | pkgs.nodePackages.grunt-cli |
|
|||
134 | pkgs.subversion |
|
|||
135 | rhodecode-testdata |
|
|||
136 | ]); |
|
|||
137 |
|
||||
138 | #TODO: either move this into overrides, OR use the new machanics from |
|
|||
139 | # pip2nix and requiremtn.txt file |
|
|||
140 | propagatedBuildInputs = attrs.propagatedBuildInputs ++ (with self; [ |
|
|||
141 | rhodecode-tools |
|
|||
142 | ]); |
|
|||
143 |
|
||||
144 | # TODO: johbo: Make a nicer way to expose the parts. Maybe |
|
|||
145 | # pkgs/default.nix? |
|
|||
146 | passthru = { |
|
129 | passthru = { | |
147 | inherit |
|
130 | inherit | |
|
131 | rhodecode-testdata | |||
148 | bowerComponents |
|
132 | bowerComponents | |
149 | linkNodeAndBowerPackages |
|
133 | linkNodeAndBowerPackages | |
150 | myPythonPackagesUnfix |
|
134 | myPythonPackagesUnfix | |
151 |
pythonLocalOverrides |
|
135 | pythonLocalOverrides | |
|
136 | pythonCommunityOverrides; | |||
|
137 | ||||
152 | pythonPackages = self; |
|
138 | pythonPackages = self; | |
153 | }; |
|
139 | }; | |
154 |
|
140 | |||
|
141 | buildInputs = | |||
|
142 | attrs.buildInputs or [] ++ [ | |||
|
143 | rhodecode-testdata | |||
|
144 | pkgs.nodePackages.bower | |||
|
145 | pkgs.nodePackages.grunt-cli | |||
|
146 | ]; | |||
|
147 | ||||
|
148 | #NOTE: option to inject additional propagatedBuildInputs | |||
|
149 | propagatedBuildInputs = | |||
|
150 | attrs.propagatedBuildInputs or [] ++ [ | |||
|
151 | ||||
|
152 | ]; | |||
|
153 | ||||
155 | LC_ALL = "en_US.UTF-8"; |
|
154 | LC_ALL = "en_US.UTF-8"; | |
156 | LOCALE_ARCHIVE = |
|
155 | LOCALE_ARCHIVE = | |
157 |
if pkgs.stdenv |
|
156 | if pkgs.stdenv.isLinux | |
158 | then "${pkgs.glibcLocales}/lib/locale/locale-archive" |
|
157 | then "${pkgs.glibcLocales}/lib/locale/locale-archive" | |
159 | else ""; |
|
158 | else ""; | |
160 |
|
159 | |||
|
160 | # Add bin directory to path so that tests can find 'rhodecode'. | |||
161 | preCheck = '' |
|
161 | preCheck = '' | |
162 | export PATH="$out/bin:$PATH" |
|
162 | export PATH="$out/bin:$PATH" | |
163 | ''; |
|
163 | ''; | |
164 |
|
164 | |||
|
165 | # custom check phase for testing | |||
|
166 | checkPhase = '' | |||
|
167 | runHook preCheck | |||
|
168 | PYTHONHASHSEED=random py.test -vv -p no:sugar -r xw --cov-config=.coveragerc --cov=rhodecode --cov-report=term-missing rhodecode | |||
|
169 | runHook postCheck | |||
|
170 | ''; | |||
|
171 | ||||
165 | postCheck = '' |
|
172 | postCheck = '' | |
166 | rm -rf $out/lib/${self.python.libPrefix}/site-packages/pytest_pylons |
|
173 | echo "Cleanup of rhodecode/tests" | |
167 | rm -rf $out/lib/${self.python.libPrefix}/site-packages/rhodecode/tests |
|
174 | rm -rf $out/lib/${self.python.libPrefix}/site-packages/rhodecode/tests | |
168 | ''; |
|
175 | ''; | |
169 |
|
176 | |||
170 | preBuild = linkNodeAndBowerPackages + '' |
|
177 | preBuild = '' | |
|
178 | ||||
|
179 | echo "Building frontend assets" | |||
|
180 | ${linkNodeAndBowerPackages} | |||
171 | grunt |
|
181 | grunt | |
172 | rm -fr node_modules |
|
182 | rm -fr node_modules | |
173 | ''; |
|
183 | ''; | |
174 |
|
184 | |||
175 | postInstall = '' |
|
185 | postInstall = '' | |
176 | echo "Writing meta information for rccontrol to nix-support/rccontrol" |
|
186 | echo "Writing enterprise-ce meta information for rccontrol to nix-support/rccontrol" | |
177 | mkdir -p $out/nix-support/rccontrol |
|
187 | mkdir -p $out/nix-support/rccontrol | |
178 | cp -v rhodecode/VERSION $out/nix-support/rccontrol/version |
|
188 | cp -v rhodecode/VERSION $out/nix-support/rccontrol/version | |
179 |
echo "DONE: |
|
189 | echo "[DONE]: enterprise-ce meta information for rccontrol written" | |
|
190 | ||||
|
191 | mkdir -p $out/etc | |||
|
192 | cp configs/production.ini $out/etc | |||
|
193 | echo "[DONE]: saved enterprise-ce production.ini into $out/etc" | |||
180 |
|
194 | |||
181 | # python based programs need to be wrapped |
|
195 | # python based programs need to be wrapped | |
182 | #ln -s ${self.python}/bin/* $out/bin/ |
|
196 | mkdir -p $out/bin | |
|
197 | # rhodecode-tools | |||
|
198 | ln -s ${self.rhodecode-tools}/bin/rhodecode-* $out/bin/ | |||
|
199 | ||||
|
200 | # required binaries from dependencies | |||
|
201 | #ln -s ${self.python}/bin/python $out/bin | |||
183 | ln -s ${self.pyramid}/bin/* $out/bin/ |
|
202 | ln -s ${self.pyramid}/bin/* $out/bin/ | |
184 | ln -s ${self.gunicorn}/bin/gunicorn $out/bin/ |
|
203 | ln -s ${self.gunicorn}/bin/gunicorn $out/bin/ | |
185 | ln -s ${self.supervisor}/bin/supervisor* $out/bin/ |
|
204 | ln -s ${self.supervisor}/bin/supervisor* $out/bin/ | |
186 | ln -s ${self.pastescript}/bin/paster $out/bin/ |
|
205 | ln -s ${self.pastescript}/bin/paster $out/bin/ | |
187 | ln -s ${self.channelstream}/bin/channelstream $out/bin/ |
|
206 | ln -s ${self.channelstream}/bin/channelstream $out/bin/ | |
188 | ln -s ${self.celery}/bin/celery $out/bin/ |
|
207 | ln -s ${self.celery}/bin/celery $out/bin/ | |
|
208 | echo "[DONE]: created symlinks into $out/bin" | |||
189 |
|
209 | |||
190 | # rhodecode-tools |
|
|||
191 | ln -s ${self.rhodecode-tools}/bin/rhodecode-* $out/bin/ |
|
|||
192 |
|
||||
193 | # note that condition should be restricted when adding further tools |
|
|||
194 | for file in $out/bin/*; |
|
210 | for file in $out/bin/*; | |
195 | do |
|
211 | do | |
196 | wrapProgram $file \ |
|
212 | wrapProgram $file \ | |
197 |
|
|
213 | --prefix PATH : $PATH \ | |
198 |
|
|
214 | --prefix PYTHONPATH : $PYTHONPATH \ | |
199 |
|
|
215 | --set PYTHONHASHSEED random | |
200 | done |
|
216 | done | |
201 |
|
217 | |||
202 | mkdir $out/etc |
|
218 | echo "[DONE]: enterprise-ce binary wrapping" | |
203 | cp configs/production.ini $out/etc |
|
|||
204 |
|
219 | |||
205 |
|
||||
206 | # TODO: johbo: Make part of ac-tests |
|
|||
207 | if [ ! -f rhodecode/public/js/scripts.js ]; then |
|
220 | if [ ! -f rhodecode/public/js/scripts.js ]; then | |
208 | echo "Missing scripts.js" |
|
221 | echo "Missing scripts.js" | |
209 | exit 1 |
|
222 | exit 1 | |
210 | fi |
|
223 | fi | |
211 | if [ ! -f rhodecode/public/css/style.css ]; then |
|
224 | if [ ! -f rhodecode/public/css/style.css ]; then | |
212 | echo "Missing style.css" |
|
225 | echo "Missing style.css" | |
213 | exit 1 |
|
226 | exit 1 | |
214 | fi |
|
227 | fi | |
215 | ''; |
|
228 | ''; | |
216 |
|
||||
217 | }); |
|
229 | }); | |
218 |
|
230 | |||
219 | rhodecode-testdata = import "${rhodecode-testdata-src}/default.nix" { |
|
|||
220 | inherit |
|
|||
221 | doCheck |
|
|||
222 | pkgs |
|
|||
223 | pythonPackages; |
|
|||
224 | }; |
|
|||
225 |
|
||||
226 | }; |
|
231 | }; | |
227 |
|
232 | |||
228 | rhodecode-testdata-src = sources.rhodecode-testdata or ( |
|
233 | basePythonPackages = with builtins; | |
229 | pkgs.fetchhg { |
|
234 | if isAttrs pythonPackages then | |
230 | url = "https://code.rhodecode.com/upstream/rc_testdata"; |
|
235 | pythonPackages | |
231 | rev = "v0.10.0"; |
|
236 | else | |
232 | sha256 = "0zn9swwvx4vgw4qn8q3ri26vvzgrxn15x6xnjrysi1bwmz01qjl0"; |
|
237 | getAttr pythonPackages pkgs; | |
233 | }); |
|
238 | ||
|
239 | pythonGeneratedPackages = import ./pkgs/python-packages.nix { | |||
|
240 | inherit pkgs; | |||
|
241 | inherit (pkgs) fetchurl fetchgit fetchhg; | |||
|
242 | }; | |||
|
243 | ||||
|
244 | pythonCommunityOverrides = import ./pkgs/python-packages-overrides.nix { | |||
|
245 | inherit pkgs basePythonPackages; | |||
|
246 | }; | |||
234 |
|
247 | |||
235 | # Apply all overrides and fix the final package set |
|
248 | # Apply all overrides and fix the final package set | |
236 | myPythonPackagesUnfix = with pkgs.lib; |
|
249 | myPythonPackagesUnfix = with pkgs.lib; | |
237 | (extends pythonExternalOverrides |
|
250 | (extends pythonExternalOverrides | |
238 | (extends pythonLocalOverrides |
|
251 | (extends pythonLocalOverrides | |
239 | (extends pythonOverrides |
|
252 | (extends pythonCommunityOverrides | |
240 |
|
|
253 | (extends pythonGeneratedPackages | |
|
254 | basePythonPackagesUnfix)))); | |||
|
255 | ||||
241 | myPythonPackages = (pkgs.lib.fix myPythonPackagesUnfix); |
|
256 | myPythonPackages = (pkgs.lib.fix myPythonPackagesUnfix); | |
242 |
|
257 | |||
243 | in myPythonPackages.rhodecode-enterprise-ce |
|
258 | in myPythonPackages.rhodecode-enterprise-ce |
@@ -1,226 +1,226 | |||||
1 | .. _dev-setup: |
|
1 | .. _dev-setup: | |
2 |
|
2 | |||
3 | =================== |
|
3 | =================== | |
4 | Development setup |
|
4 | Development setup | |
5 | =================== |
|
5 | =================== | |
6 |
|
6 | |||
7 |
|
7 | |||
8 | RhodeCode Enterprise runs inside a Nix managed environment. This ensures build |
|
8 | RhodeCode Enterprise runs inside a Nix managed environment. This ensures build | |
9 | environment dependencies are correctly declared and installed during setup. |
|
9 | environment dependencies are correctly declared and installed during setup. | |
10 | It also enables atomic upgrades, rollbacks, and multiple instances of RhodeCode |
|
10 | It also enables atomic upgrades, rollbacks, and multiple instances of RhodeCode | |
11 | Enterprise running with isolation. |
|
11 | Enterprise running with isolation. | |
12 |
|
12 | |||
13 | To set up RhodeCode Enterprise inside the Nix environment, use the following steps: |
|
13 | To set up RhodeCode Enterprise inside the Nix environment, use the following steps: | |
14 |
|
14 | |||
15 |
|
15 | |||
16 |
|
16 | |||
17 | Setup Nix Package Manager |
|
17 | Setup Nix Package Manager | |
18 | ------------------------- |
|
18 | ------------------------- | |
19 |
|
19 | |||
20 | To install the Nix Package Manager, please run:: |
|
20 | To install the Nix Package Manager, please run:: | |
21 |
|
21 | |||
22 | $ curl https://nixos.org/nix/install | sh |
|
22 | $ curl https://nixos.org/nix/install | sh | |
23 |
|
23 | |||
24 | or go to https://nixos.org/nix/ and follow the installation instructions. |
|
24 | or go to https://nixos.org/nix/ and follow the installation instructions. | |
25 | Once this is correctly set up on your system, you should be able to use the |
|
25 | Once this is correctly set up on your system, you should be able to use the | |
26 | following commands: |
|
26 | following commands: | |
27 |
|
27 | |||
28 | * `nix-env` |
|
28 | * `nix-env` | |
29 |
|
29 | |||
30 | * `nix-shell` |
|
30 | * `nix-shell` | |
31 |
|
31 | |||
32 |
|
32 | |||
33 | .. tip:: |
|
33 | .. tip:: | |
34 |
|
34 | |||
35 | Update your channels frequently by running ``nix-channel --update``. |
|
35 | Update your channels frequently by running ``nix-channel --update``. | |
36 |
|
36 | |||
37 | .. note:: |
|
37 | .. note:: | |
38 |
|
38 | |||
39 | To uninstall nix run the following: |
|
39 | To uninstall nix run the following: | |
40 |
|
40 | |||
41 | remove the . "$HOME/.nix-profile/etc/profile.d/nix.sh" line in your ~/.profile or ~/.bash_profile |
|
41 | remove the . "$HOME/.nix-profile/etc/profile.d/nix.sh" line in your ~/.profile or ~/.bash_profile | |
42 | rm -rf $HOME/{.nix-channels,.nix-defexpr,.nix-profile,.config/nixpkgs} |
|
42 | rm -rf $HOME/{.nix-channels,.nix-defexpr,.nix-profile,.config/nixpkgs} | |
43 | sudo rm -rf /nix |
|
43 | sudo rm -rf /nix | |
44 |
|
44 | |||
45 | Switch nix to the latest STABLE channel |
|
45 | Switch nix to the latest STABLE channel | |
46 | --------------------------------------- |
|
46 | --------------------------------------- | |
47 |
|
47 | |||
48 | run:: |
|
48 | run:: | |
49 |
|
49 | |||
50 |
nix-channel --add https://nixos.org/channels/nixos-1 |
|
50 | nix-channel --add https://nixos.org/channels/nixos-18.03 nixpkgs | |
51 |
|
51 | |||
52 | Followed by:: |
|
52 | Followed by:: | |
53 |
|
53 | |||
54 | nix-channel --update |
|
54 | nix-channel --update | |
55 |
|
55 | |||
56 |
|
56 | |||
57 | Install required binaries |
|
57 | Install required binaries | |
58 | ------------------------- |
|
58 | ------------------------- | |
59 |
|
59 | |||
60 | We need some handy tools first. |
|
60 | We need some handy tools first. | |
61 |
|
61 | |||
62 | run:: |
|
62 | run:: | |
63 |
|
63 | |||
64 | nix-env -i nix-prefetch-hg |
|
64 | nix-env -i nix-prefetch-hg | |
65 | nix-env -i nix-prefetch-git |
|
65 | nix-env -i nix-prefetch-git | |
66 |
|
66 | |||
67 |
|
67 | |||
68 | Clone the required repositories |
|
68 | Clone the required repositories | |
69 | ------------------------------- |
|
69 | ------------------------------- | |
70 |
|
70 | |||
71 | After Nix is set up, clone the RhodeCode Enterprise Community Edition and |
|
71 | After Nix is set up, clone the RhodeCode Enterprise Community Edition and | |
72 | RhodeCode VCSServer repositories into the same directory. |
|
72 | RhodeCode VCSServer repositories into the same directory. | |
73 | RhodeCode currently is using Mercurial Version Control System, please make sure |
|
73 | RhodeCode currently is using Mercurial Version Control System, please make sure | |
74 | you have it installed before continuing. |
|
74 | you have it installed before continuing. | |
75 |
|
75 | |||
76 | To obtain the required sources, use the following commands:: |
|
76 | To obtain the required sources, use the following commands:: | |
77 |
|
77 | |||
78 | mkdir rhodecode-develop && cd rhodecode-develop |
|
78 | mkdir rhodecode-develop && cd rhodecode-develop | |
79 | hg clone https://code.rhodecode.com/rhodecode-enterprise-ce |
|
79 | hg clone https://code.rhodecode.com/rhodecode-enterprise-ce | |
80 | hg clone https://code.rhodecode.com/rhodecode-vcsserver |
|
80 | hg clone https://code.rhodecode.com/rhodecode-vcsserver | |
81 |
|
81 | |||
82 | .. note:: |
|
82 | .. note:: | |
83 |
|
83 | |||
84 | If you cannot clone the repository, please contact us via support@rhodecode.com |
|
84 | If you cannot clone the repository, please contact us via support@rhodecode.com | |
85 |
|
85 | |||
86 |
|
86 | |||
87 | Install some required libraries |
|
87 | Install some required libraries | |
88 | ------------------------------- |
|
88 | ------------------------------- | |
89 |
|
89 | |||
90 | There are some required drivers and dev libraries that we need to install to |
|
90 | There are some required drivers and dev libraries that we need to install to | |
91 | test RhodeCode under different types of databases. For example in Ubuntu we |
|
91 | test RhodeCode under different types of databases. For example in Ubuntu we | |
92 | need to install the following. |
|
92 | need to install the following. | |
93 |
|
93 | |||
94 | required libraries:: |
|
94 | required libraries:: | |
95 |
|
95 | |||
96 | sudo apt-get install libapr1-dev libaprutil1-dev |
|
96 | sudo apt-get install libapr1-dev libaprutil1-dev | |
97 | sudo apt-get install libsvn-dev |
|
97 | sudo apt-get install libsvn-dev | |
98 | sudo apt-get install mysql-server libmysqlclient-dev |
|
98 | sudo apt-get install mysql-server libmysqlclient-dev | |
99 | sudo apt-get install postgresql postgresql-contrib libpq-dev |
|
99 | sudo apt-get install postgresql postgresql-contrib libpq-dev | |
100 | sudo apt-get install libcurl4-openssl-dev |
|
100 | sudo apt-get install libcurl4-openssl-dev | |
101 |
|
101 | |||
102 |
|
102 | |||
103 | Enter the Development Shell |
|
103 | Enter the Development Shell | |
104 | --------------------------- |
|
104 | --------------------------- | |
105 |
|
105 | |||
106 | The final step is to start the development shells. To do this, run the |
|
106 | The final step is to start the development shells. To do this, run the | |
107 | following command from inside the cloned repository:: |
|
107 | following command from inside the cloned repository:: | |
108 |
|
108 | |||
109 | #first, the vcsserver |
|
109 | #first, the vcsserver | |
110 | cd ~/rhodecode-vcsserver |
|
110 | cd ~/rhodecode-vcsserver | |
111 | nix-shell |
|
111 | nix-shell | |
112 |
|
112 | |||
113 | # then enterprise sources |
|
113 | # then enterprise sources | |
114 | cd ~/rhodecode-enterprise-ce |
|
114 | cd ~/rhodecode-enterprise-ce | |
115 | nix-shell |
|
115 | nix-shell | |
116 |
|
116 | |||
117 | .. note:: |
|
117 | .. note:: | |
118 |
|
118 | |||
119 | On the first run, this will take a while to download and optionally compile |
|
119 | On the first run, this will take a while to download and optionally compile | |
120 | a few things. The following runs will be faster. The development shell works |
|
120 | a few things. The following runs will be faster. The development shell works | |
121 | fine on both MacOS and Linux platforms. |
|
121 | fine on both MacOS and Linux platforms. | |
122 |
|
122 | |||
123 |
|
123 | |||
124 | Create config.nix for development |
|
124 | Create config.nix for development | |
125 | --------------------------------- |
|
125 | --------------------------------- | |
126 |
|
126 | |||
127 | In order to run proper tests and setup linking across projects, a config.nix |
|
127 | In order to run proper tests and setup linking across projects, a config.nix | |
128 | file needs to be setup:: |
|
128 | file needs to be setup:: | |
129 |
|
129 | |||
130 | # create config |
|
130 | # create config | |
131 | mkdir -p ~/.nixpkgs |
|
131 | mkdir -p ~/.nixpkgs | |
132 | touch ~/.nixpkgs/config.nix |
|
132 | touch ~/.nixpkgs/config.nix | |
133 |
|
133 | |||
134 | # put the below content into the ~/.nixpkgs/config.nix file |
|
134 | # put the below content into the ~/.nixpkgs/config.nix file | |
135 | # adjusts, the path to where you cloned your repositories. |
|
135 | # adjusts, the path to where you cloned your repositories. | |
136 |
|
136 | |||
137 | { |
|
137 | { | |
138 | rc = { |
|
138 | rc = { | |
139 | sources = { |
|
139 | sources = { | |
140 | rhodecode-vcsserver = "/home/dev/rhodecode-vcsserver"; |
|
140 | rhodecode-vcsserver = "/home/dev/rhodecode-vcsserver"; | |
141 | rhodecode-enterprise-ce = "/home/dev/rhodecode-enterprise-ce"; |
|
141 | rhodecode-enterprise-ce = "/home/dev/rhodecode-enterprise-ce"; | |
142 | rhodecode-enterprise-ee = "/home/dev/rhodecode-enterprise-ee"; |
|
142 | rhodecode-enterprise-ee = "/home/dev/rhodecode-enterprise-ee"; | |
143 | }; |
|
143 | }; | |
144 | }; |
|
144 | }; | |
145 | } |
|
145 | } | |
146 |
|
146 | |||
147 |
|
147 | |||
148 |
|
148 | |||
149 | Creating a Development Configuration |
|
149 | Creating a Development Configuration | |
150 | ------------------------------------ |
|
150 | ------------------------------------ | |
151 |
|
151 | |||
152 | To create a development environment for RhodeCode Enterprise, |
|
152 | To create a development environment for RhodeCode Enterprise, | |
153 | use the following steps: |
|
153 | use the following steps: | |
154 |
|
154 | |||
155 | 1. Create a copy of vcsserver config: |
|
155 | 1. Create a copy of vcsserver config: | |
156 | `cp ~/rhodecode-vcsserver/configs/development.ini ~/rhodecode-vcsserver/configs/dev.ini` |
|
156 | `cp ~/rhodecode-vcsserver/configs/development.ini ~/rhodecode-vcsserver/configs/dev.ini` | |
157 | 2. Create a copy of rhodocode config: |
|
157 | 2. Create a copy of rhodocode config: | |
158 | `cp ~/rhodecode-enterprise-ce/configs/development.ini ~/rhodecode-enterprise-ce/configs/dev.ini` |
|
158 | `cp ~/rhodecode-enterprise-ce/configs/development.ini ~/rhodecode-enterprise-ce/configs/dev.ini` | |
159 | 3. Adjust the configuration settings to your needs if needed. |
|
159 | 3. Adjust the configuration settings to your needs if needed. | |
160 |
|
160 | |||
161 | .. note:: |
|
161 | .. note:: | |
162 |
|
162 | |||
163 | It is recommended to use the name `dev.ini` since it's included in .hgignore file. |
|
163 | It is recommended to use the name `dev.ini` since it's included in .hgignore file. | |
164 |
|
164 | |||
165 |
|
165 | |||
166 | Setup the Development Database |
|
166 | Setup the Development Database | |
167 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
|
167 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
168 |
|
168 | |||
169 | To create a development database, use the following example. This is a one |
|
169 | To create a development database, use the following example. This is a one | |
170 | time operation executed from the nix-shell of rhodecode-enterprise-ce sources :: |
|
170 | time operation executed from the nix-shell of rhodecode-enterprise-ce sources :: | |
171 |
|
171 | |||
172 | rc-setup-app dev.ini \ |
|
172 | rc-setup-app dev.ini \ | |
173 | --user=admin --password=secret \ |
|
173 | --user=admin --password=secret \ | |
174 | --email=admin@example.com \ |
|
174 | --email=admin@example.com \ | |
175 | --repos=~/my_dev_repos |
|
175 | --repos=~/my_dev_repos | |
176 |
|
176 | |||
177 |
|
177 | |||
178 | Compile CSS and JavaScript |
|
178 | Compile CSS and JavaScript | |
179 | ^^^^^^^^^^^^^^^^^^^^^^^^^^ |
|
179 | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
180 |
|
180 | |||
181 | To use the application's frontend and prepare it for production deployment, |
|
181 | To use the application's frontend and prepare it for production deployment, | |
182 | you will need to compile the CSS and JavaScript with Grunt. |
|
182 | you will need to compile the CSS and JavaScript with Grunt. | |
183 | This is easily done from within the nix-shell using the following command:: |
|
183 | This is easily done from within the nix-shell using the following command:: | |
184 |
|
184 | |||
185 | grunt |
|
185 | grunt | |
186 |
|
186 | |||
187 | When developing new features you will need to recompile following any |
|
187 | When developing new features you will need to recompile following any | |
188 | changes made to the CSS or JavaScript files when developing the code:: |
|
188 | changes made to the CSS or JavaScript files when developing the code:: | |
189 |
|
189 | |||
190 | grunt watch |
|
190 | grunt watch | |
191 |
|
191 | |||
192 | This prepares the development (with comments/whitespace) versions of files. |
|
192 | This prepares the development (with comments/whitespace) versions of files. | |
193 |
|
193 | |||
194 | Start the Development Servers |
|
194 | Start the Development Servers | |
195 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
|
195 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
196 |
|
196 | |||
197 | From the rhodecode-vcsserver directory, start the development server in another |
|
197 | From the rhodecode-vcsserver directory, start the development server in another | |
198 | nix-shell, using the following command:: |
|
198 | nix-shell, using the following command:: | |
199 |
|
199 | |||
200 | pserve configs/dev.ini |
|
200 | pserve configs/dev.ini | |
201 |
|
201 | |||
202 | In the adjacent nix-shell which you created for your development server, you may |
|
202 | In the adjacent nix-shell which you created for your development server, you may | |
203 | now start CE with the following command:: |
|
203 | now start CE with the following command:: | |
204 |
|
204 | |||
205 |
|
205 | |||
206 | pserve --reload configs/dev.ini |
|
206 | pserve --reload configs/dev.ini | |
207 |
|
207 | |||
208 | .. note:: |
|
208 | .. note:: | |
209 |
|
209 | |||
210 | `--reload` flag will automatically reload the server when source file changes. |
|
210 | `--reload` flag will automatically reload the server when source file changes. | |
211 |
|
211 | |||
212 |
|
212 | |||
213 | Run the Environment Tests |
|
213 | Run the Environment Tests | |
214 | ^^^^^^^^^^^^^^^^^^^^^^^^^ |
|
214 | ^^^^^^^^^^^^^^^^^^^^^^^^^ | |
215 |
|
215 | |||
216 | Please make sure that the tests are passing to verify that your environment is |
|
216 | Please make sure that the tests are passing to verify that your environment is | |
217 | set up correctly. RhodeCode uses py.test to run tests. |
|
217 | set up correctly. RhodeCode uses py.test to run tests. | |
218 | While your instance is running, start a new nix-shell and simply run |
|
218 | While your instance is running, start a new nix-shell and simply run | |
219 | ``make test`` to run the basic test suite. |
|
219 | ``make test`` to run the basic test suite. | |
220 |
|
220 | |||
221 |
|
221 | |||
222 | Need Help? |
|
222 | Need Help? | |
223 | ^^^^^^^^^^ |
|
223 | ^^^^^^^^^^ | |
224 |
|
224 | |||
225 | Join us on Slack via https://rhodecode.com/join or post questions in our |
|
225 | Join us on Slack via https://rhodecode.com/join or post questions in our | |
226 | Community Portal at https://community.rhodecode.com |
|
226 | Community Portal at https://community.rhodecode.com |
@@ -1,25 +1,32 | |||||
1 | { |
|
1 | { | |
2 | "name": "rhodecode-enterprise", |
|
2 | "name": "rhodecode-enterprise", | |
3 |
"version": "0.0 |
|
3 | "version": "1.0.0", | |
|
4 | "private": true, | |||
|
5 | "description" : "RhodeCode JS packaged", | |||
|
6 | "license": "SEE LICENSE IN LICENSE.txt", | |||
|
7 | "repository" : { | |||
|
8 | "type" : "hg", | |||
|
9 | "url" : "https://code.rhodecode.com/rhodecode-enterprise-ce" | |||
|
10 | }, | |||
4 | "devDependencies": { |
|
11 | "devDependencies": { | |
5 | "grunt": "^0.4.5", |
|
12 | "grunt": "^0.4.5", | |
6 | "grunt-contrib-copy": "^1.0.0", |
|
13 | "grunt-contrib-copy": "^1.0.0", | |
7 | "grunt-contrib-concat": "^0.5.1", |
|
14 | "grunt-contrib-concat": "^0.5.1", | |