forked from tsuru/platforms
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refs tsuru#20
- Loading branch information
Showing
6 changed files
with
93 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Copyright 2016 tsuru authors. All rights reserved. | ||
# Use of this source code is governed by a BSD-style | ||
# license that can be found in the LICENSE file. | ||
|
||
FROM tsuru/base-platform | ||
RUN pwd | ||
RUN ls | ||
RUN ls . | ||
ADD . /var/lib/tsuru/rust | ||
RUN cp /var/lib/tsuru/rust/deploy /var/lib/tsuru | ||
RUN /var/lib/tsuru/rust/install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
web: %web% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Rust Platform | ||
|
||
The Rust platform supports code deployment, the application is built in the | ||
target. | ||
|
||
|
||
## Code deployment | ||
|
||
If you just run a ``git push`` of your code, tsuru will install the application | ||
using ``cargo install`` – which fetches all the dependencies automatically. | ||
|
||
##Binary deployment | ||
|
||
For binary deployment, ensure the name of the binary file matches what's in | ||
Procfile. Also make sure it matches the target platform (usually linux_amd64), | ||
For example: | ||
|
||
$ ls | ||
Cargo.lock Cargo.toml src target | ||
$ rustup target add x86_64-unknown-linux-gnu | ||
$ cargo build --release --target=x86_64-unknown-linux-gnu | ||
$ cat Procfile | ||
web: ./hello_world | ||
$ tsuru app-deploy -a [app-name] target/x86_64-unknown-linux-gnu/release/hello_world Procfile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/bin/bash -el | ||
|
||
# Copyright 2016 tsuru authors. All rights reserved. | ||
# Use of this source code is governed by a BSD-style | ||
# license that can be found in the LICENSE file. | ||
|
||
SOURCE_DIR=/var/lib/tsuru | ||
source ${SOURCE_DIR}/base/deploy | ||
source ${SOURCE_DIR}/base/rc/config | ||
|
||
if [ -f ${CURRENT_DIR}/Cargo.toml ]; then | ||
pushd ${CURRENT_DIR} >/dev/null 2>&1 | ||
if [ ! -f ${CURRENT_DIR}/Procfile ]; then | ||
echo "Procfile not found, using default one." | ||
PKG_NAME=$(awk -F ' *= *' \ | ||
'{if ($1 ~ /^\[package\]/) stop=1; else if ($1 ~ /^name$/ && stop){print $2; exit}}' \ | ||
${CURRENT_DIR}/Cargo.toml | cut -d\" -f2) | ||
echo "Package name: $PKG_NAME" | ||
sed s:%web%:$PKG_NAME: ${SOURCE_DIR}/default/Procfile > ${CURRENT_DIR}/Procfile | ||
fi | ||
cargo install --force --verbose | ||
popd >/dev/null 2>&1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/bin/bash -el | ||
|
||
# Copyright 2016 tsuru authors. All rights reserved. | ||
# Use of this source code is governed by a BSD-style | ||
# license that can be found in the LICENSE file. | ||
|
||
SOURCE_DIR=/var/lib/tsuru | ||
source ${SOURCE_DIR}/base/rc/config | ||
|
||
# As of 2016-07-07 `file` is needed. Please check: | ||
# https://github.com/rust-lang-nursery/rustup.rs/issues/466 | ||
apt-get update && apt-get install -y file gcc git | ||
|
||
sh <(curl -sSf https://static.rust-lang.org/rustup.sh) --verbose -y --channel=stable | ||
|
||
cp ${SOURCE_DIR}/rust/Procfile ${SOURCE_DIR}/default/Procfile | ||
|
||
CARGO_HOME=${APP_DIR}/.cargo | ||
mkdir -p ${CARGO_HOME}/bin | ||
mkdir ${CARGO_HOME}/target | ||
|
||
echo "export CARGO_HOME=${CARGO_HOME}" >> ${HOME}/.profile | ||
echo 'export CARGO_TARGET_DIR=$CARGO_HOME/target' >> ${HOME}/.profile | ||
echo 'PATH=$CARGO_HOME/bin:$PATH' >> ${HOME}/.profile | ||
|
||
chown -R ${USER}:${USER} ${CARGO_HOME} |