Skip to content

Commit 4668b72

Browse files
committed
initial files
1 parent 108116a commit 4668b72

File tree

12 files changed

+283
-1
lines changed

12 files changed

+283
-1
lines changed

.env.sample

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
APP_HOST=localhost
2+
APP_PORT=5000

.gitignore

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
# Created by https://www.gitignore.io/api/rust,code
2+
# Edit at https://www.gitignore.io/?templates=rust,code
3+
4+
### Code ###
5+
.vscode/*
6+
!.vscode/settings.json
7+
!.vscode/tasks.json
8+
!.vscode/launch.json
9+
!.vscode/extensions.json
10+
11+
### Rust ###
112
# Generated by Cargo
213
# will have compiled files and executables
314
/target/
@@ -8,3 +19,11 @@ Cargo.lock
819

920
# These are backup files generated by rustfmt
1021
**/*.rs.bk
22+
23+
# Extras
24+
.env
25+
/src/secret.key
26+
27+
# End of https://www.gitignore.io/api/rust,code
28+
29+
.idea

CHANGELOG.md

Whitespace-only changes.

CONTRIBUTING.md

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# Contribution guidelines
2+
3+
First off, thank you for considering contributing to stackdog.
4+
5+
If your contribution is not straightforward, please first discuss the change you
6+
wish to make by creating a new issue before making the change.
7+
8+
## Reporting issues
9+
10+
Before reporting an issue on the
11+
[issue tracker](https://github.com/vsilent/stackdog/issues),
12+
please check that it has not already been reported by searching for some related
13+
keywords.
14+
15+
## Pull requests
16+
17+
Try to do one pull request per change.
18+
19+
### Updating the changelog
20+
21+
Update the changes you have made in
22+
[CHANGELOG](https://github.com/vsilent/stackdog/blob/master/CHANGELOG.md)
23+
file under the **Unreleased** section.
24+
25+
Add the changes of your pull request to one of the following subsections,
26+
depending on the types of changes defined by
27+
[Keep a changelog](https://keepachangelog.com/en/1.0.0/):
28+
29+
- `Added` for new features.
30+
- `Changed` for changes in existing functionality.
31+
- `Deprecated` for soon-to-be removed features.
32+
- `Removed` for now removed features.
33+
- `Fixed` for any bug fixes.
34+
- `Security` in case of vulnerabilities.
35+
36+
If the required subsection does not exist yet under **Unreleased**, create it!
37+
38+
## Developing
39+
40+
### Set up
41+
42+
This is no different than other Rust projects.
43+
44+
```shell
45+
git clone https://github.com/vsilent/stackdog
46+
cd stackdog
47+
cargo build
48+
```
49+
50+
### Useful Commands
51+
52+
- Build and run release version:
53+
54+
```shell
55+
cargo build --release && cargo run --release
56+
```
57+
58+
- Run Clippy:
59+
60+
```shell
61+
cargo clippy --all
62+
```
63+
64+
- Run all tests:
65+
66+
```shell
67+
cargo test --all
68+
```
69+
70+
- Check to see if there are code formatting issues
71+
72+
```shell
73+
cargo fmt --all -- --check
74+
```
75+
76+
- Format the code in the project
77+
78+
```shell
79+
cargo fmt --all
80+
```

Cargo.toml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
[package]
2+
name = "stackdog"
3+
version = "0.1.0"
4+
authors = ["Vasili Pascal <info@try.direct>"]
5+
edition = "2018"
6+
7+
#[package.metadata.docs.rs]
8+
#features = ["openssl", "rustls", "compress", "secure-cookies"]
9+
#
10+
#[dependencies]
11+
#actix-web = { version = "3.0.0-alpha.2", features=["rustls"] }
12+
#actix-rt = "1.1.1"
13+
#actix-service = "1.0.6"
14+
#actix-cors = "0.3.0"
15+
#actix-http = "2.1.0"
16+
#actix = "0.10"
17+
#log = "0.4.11"
18+
#env_logger = "0.7.1"
19+
#serde = "1.0.116"
20+
#serde_derive = "1.0.116"
21+
#serde_json = "1.0.57"
22+
#dotenv = "0.15.0"
23+
#futures = "0.3.5"
24+
#failure = "0.1.8"
25+
#derive_more = "0.99.10"
26+
#jsonwebtoken = "7.2.0"
27+
#bcrypt = "0.8.2"
28+
#actix-tls = "2.0.0"
29+
#awc = { version = "2.0.0", default-features = false }
30+
#open-ssl = { package = "openssl", version = "0.10", optional = true }
31+
#rust-tls = { package = "rustls", version = "0.18.0", optional = true }
32+
#
33+
#[features]
34+
## openssl
35+
#openssl = ["actix-tls/openssl", "awc/openssl", "open-ssl"]
36+
## rustls
37+
#rustls = ["actix-tls/rustls", "awc/rustls", "rust-tls"]
38+
#default = ["compress"]
39+
#
40+
## content-encoding support
41+
#compress = ["actix-http/compress", "awc/compress"]
42+
#
43+
## sessions feature
44+
#secure-cookies = ["actix-http/secure-cookies"]
45+
#
46+
#[dependencies.chrono]
47+
#version = "0.4.15"
48+
#features = ["serde"]

README.md

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,30 @@
11
# stackdog
2-
Docker Container Management with Rust and WebAssembly
2+
Docker Container Management with Rust
3+
4+
[![Crates.io](https://img.shields.io/crates/v/stackdog.svg)](https://crates.io/crates/stackdog)
5+
[![Docs.rs](https://docs.rs/stackdog/badge.svg)](https://docs.rs/stackdog)
6+
[![CI](https://github.com/vsilent/stackdog/workflows/Continuous%20Integration/badge.svg)](https://github.com/vsilent/stackdog/actions)
7+
[![Coverage Status](https://coveralls.io/repos/github/vsilent/stackdog/badge.svg?branch=master)](https://coveralls.io/github/vsilent/stackdog?branch=master)
8+
9+
## Development environment
10+
11+
```
12+
cp .env.sample .env
13+
docker-compose up
14+
```
15+
16+
## License
17+
18+
Licensed under either of
19+
20+
* MIT license
21+
([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
22+
23+
24+
## Contribution
25+
26+
Unless you explicitly state otherwise, any contribution intentionally submitted
27+
for inclusion in the work by you, as defined in the Apache-2.0 license, shall be
28+
dual licensed as above, without any additional terms or conditions.
29+
30+
See [CONTRIBUTING.md](CONTRIBUTING.md).

docker-compose.dev.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version: '3'
2+
services:
3+
stackdog:
4+
container_name: backend
5+
build:
6+
context: .
7+
dockerfile: docker/dev/Dockerfile
8+
restart: always
9+
ports:
10+
- "5000:5000"
11+
env_file: .env

docker-compose.prod.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
version: '3'
2+
services:
3+
stackdog:
4+
container_name: backend
5+
image: trydirect/stackdog
6+
restart: always
7+
ports:
8+
- "5000:5000"
9+
env_file: .env

docker-compose.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
version: '3'
2+
3+
services:
4+
stackdog:
5+
container_name: backend
6+
build:
7+
context: .
8+
dockerfile: docker/local/Dockerfile
9+
# entrypoint: [ 'bash', '-c', 'sleep infinity' ]
10+
# restart: always
11+
ports:
12+
- "5000:5000"
13+
env_file: .env

docker/local/Dockerfile

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# build stage
2+
FROM rust:slim as build
3+
4+
# install libpq and create new empty binary project
5+
RUN apt-get update; \
6+
apt-get install --no-install-recommends -y libpq-dev; \
7+
rm -rf /var/lib/apt/lists/*; \
8+
USER=root cargo new --bin app
9+
WORKDIR /app
10+
11+
# copy manifests
12+
COPY ./Cargo.toml ./Cargo.toml
13+
14+
# build this project to cache dependencies
15+
RUN cargo build --release; \
16+
rm src/*.rs
17+
18+
# copy project source and necessary files
19+
COPY ./src ./src
20+
21+
# add .env and secret.key for Docker env
22+
RUN touch .env;
23+
24+
# rebuild app with project source
25+
RUN rm -rf ./target/release/deps/stackdog*; \
26+
cargo build --release
27+
28+
# deploy stage
29+
FROM debian:buster-slim
30+
31+
# create app directory
32+
WORKDIR /app
33+
34+
# install libpq
35+
RUN apt-get update; \
36+
apt-get install --no-install-recommends -y libpq-dev; \
37+
rm -rf /var/lib/apt/lists/*
38+
39+
# copy binary and configuration files
40+
COPY --from=build /app/target/release/stackdog .
41+
COPY --from=build /app/.env .
42+
43+
# expose port
44+
EXPOSE 5000
45+
46+
# run the binary
47+
ENTRYPOINT ["/app/stackdog"]

0 commit comments

Comments
 (0)