Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setup: add cross compiling machine #244

Merged
merged 3 commits into from
Dec 7, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions setup/ansible-inventory
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ iojs-ns-pi2-3
iojs-ns-pi2-4
iojs-ns-pi2-5

[nodejs-cross-compiler]
node-msft-cross-compiler-1.cloudapp.net

[iojs-www]
iojs-www

Expand Down
19 changes: 19 additions & 0 deletions setup/cross-compiler/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Node.js Build Cross Compiler Setup

For setting up a Ubuntu 14.04 box as a cross compiler. Current setup includes Raspberry Pi.

```text
Host node-msft-cross-compiler-1.cloudapp.net
HostName node-msft-cross-compiler-1.cloudapp.net
User root
```

Note that these hostnames are also used in the *ansible-inventory* file. The IP addresses will need to be updated each time the servers are reprovisioned.

To set up a host, run:

```text
$ ansible-playbook -i ../ansible-inventory ansible-playbook.yaml
```

**Users**: The ansible-vars.yaml file contains a list of users who's GitHub public keys are pulled and placed into authorized_keys for both root and iojs users. This file should be updates when new users are added to the build project who are able to help maintain the containerized builds.
87 changes: 87 additions & 0 deletions setup/cross-compiler/ansible-playbook.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
---
- hosts: nodejs-cross-compiler

remote_user: azureuser
sudo: yes

tasks:

- include_vars: ansible-vars.yaml
tags: vars

- name: General | Install updated git PPA
apt_repository: repo='ppa:git-core/ppa'
tags: general

- name: General | APT Update
apt: update_cache=yes
tags: general

- name: General | APT Upgrade
apt: upgrade=full
tags: general

- name: General | Install required packages
apt: name={{ item }} update_cache=yes state=latest
with_items: packages

This comment was marked as off-topic.

tags: general

- name: General | Increase file descriptor limits
lineinfile: dest=/etc/security/limits.conf line="{{ item }}"
with_items:
- "* hard nofile 500000"
- "* soft nofile 500000"
- "root hard nofile 500000"
- "root soft nofile 500000"
tags: general

- include: ../ansible-tasks/ccache.yaml version=3.2.3
tags: ccache

- name: User | Add {{ server_user }} user
user: name="{{ server_user }}" shell=/bin/bash
tags: user

- name: Raspberry | Clone raspberry tools repository
git: repo=https://github.com/raspberrypi/tools.git dest=/opt/raspberrypi/tools
tags: raspberry

- name: Raspberry | Copy cc-armv6.sh script
copy: src=./resources/cc-armv6.sh dest=/opt/raspberrypi/cc-armv6.sh mode=0755
tags: raspberry

- name: Raspberry | Copy cc-armv7.sh script
copy: src=./resources/cc-armv7.sh dest=/opt/raspberrypi/cc-armv7.sh mode=0755
tags: raspberry

- name: User | Download pubkey(s)
get_url: url=https://github.com/{{ item }}.keys dest=/tmp/{{ item }}.keys

This comment was marked as off-topic.

delegate_to: 127.0.0.1
become: no
with_items: ssh_users
tags: user

- name: General | Create authorized_keys for root
authorized_key: user="root" key="{{ lookup('file', '/tmp/' + item + '.keys') }}"
with_items: ssh_users

This comment was marked as off-topic.

tags: user

- name: General | Create authorized_keys for azureuser
authorized_key: user="azureuser" key="{{ lookup('file', '/tmp/' + item + '.keys') }}"
with_items: ssh_users
tags: user

- name: General | Create authorized_keys for {{ server_user }}
authorized_key: user="{{ server_user }}" key="{{ lookup('file', '/tmp/' + item + '.keys') }}"
with_items: ssh_users
tags: user

- name: User | Download Jenkins pubkey
get_url: url=https://gist.githubusercontent.com/nodejs-ci/cea606894437b45e99d0/raw/ci-iojs-org-id_rsa-slaves.pub dest=/tmp/nodejs-ci.keys
delegate_to: 127.0.0.1
become: no
tags: user

- name: General | Add Jenkins to authorized_keys for {{ server_user }}
authorized_key: user="{{ server_user }}" key="{{ lookup('file', '/tmp/nodejs-ci.keys') }}"
tags: user
19 changes: 19 additions & 0 deletions setup/cross-compiler/ansible-vars.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
server_user: iojs
ssh_users:
- rvagg
- jbergstroem
- joaocgreis
- orangemocha
packages:
- openjdk-7-jre
- git
- build-essential
- gcc-multilib
- g++-multilib
- python-all
- python-software-properties
- automake
- libtool
- curl
- monit
2 changes: 2 additions & 0 deletions setup/cross-compiler/host_vars/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
iojs-build-*
nodejs-*
4 changes: 4 additions & 0 deletions setup/cross-compiler/resources/cc-armv6.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export CC_host='ccache gcc -m32'
export CXX_host='ccache g++ -m32'
export CC="ccache /opt/raspberrypi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-gcc -march=armv6zk"
export CXX="ccache /opt/raspberrypi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-g++ -march=armv6zk"
4 changes: 4 additions & 0 deletions setup/cross-compiler/resources/cc-armv7.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export CC_host='ccache gcc -m32'
export CXX_host='ccache g++ -m32'
export CC="ccache /opt/raspberrypi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-gcc -march=armv7-a"
export CXX="ccache /opt/raspberrypi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-g++ -march=armv7-a"