Moving server to top level, now that UI is gone.

This commit is contained in:
Dessalines 2020-09-10 13:05:29 -05:00
parent 511e65d6c6
commit 413de6286c
210 changed files with 58 additions and 48 deletions

16
.gitignore vendored
View file

@ -6,16 +6,14 @@ ansible/passwords/
# docker build files # docker build files
docker/lemmy_mine.hjson docker/lemmy_mine.hjson
docker/dev/env_deploy.sh docker/dev/env_deploy.sh
docker/federation/volumes volumes
docker/federation-test/volumes
docker/dev/volumes
# local build files
build/
ui/src/translations
# ide config # ide config
.idea/ .idea
.vscode/ .vscode
# local build files
target target
env_setup.sh
query_testing/*.json
query_testing/*.json.old

0
server/Cargo.lock → Cargo.lock generated vendored
View file

View file

View file

View file

View file

24
docker/dev/Dockerfile vendored
View file

@ -15,22 +15,22 @@ RUN mkdir -p lemmy_db/src/ \
lemmy lemmy
# Copy the cargo tomls # Copy the cargo tomls
COPY server/Cargo.toml server/Cargo.lock ./ COPY Cargo.toml Cargo.lock ./
COPY server/lemmy_db/Cargo.toml ./lemmy_db/ COPY lemmy_db/Cargo.toml ./lemmy_db/
COPY server/lemmy_utils/Cargo.toml ./lemmy_utils/ COPY lemmy_utils/Cargo.toml ./lemmy_utils/
COPY server/lemmy_api_structs/Cargo.toml ./lemmy_api_structs/ COPY lemmy_api_structs/Cargo.toml ./lemmy_api_structs/
COPY server/lemmy_rate_limit/Cargo.toml ./lemmy_rate_limit/ COPY lemmy_rate_limit/Cargo.toml ./lemmy_rate_limit/
# Cache the deps # Cache the deps
RUN cargo build-deps RUN cargo build-deps
# Copy the src folders # Copy the src folders
COPY server/src ./src/ COPY src ./src/
COPY server/lemmy_db/src ./lemmy_db/src/ COPY lemmy_db/src ./lemmy_db/src/
COPY server/lemmy_utils/src/ ./lemmy_utils/src/ COPY lemmy_utils/src/ ./lemmy_utils/src/
COPY server/lemmy_api_structs/src/ ./lemmy_api_structs/src/ COPY lemmy_api_structs/src/ ./lemmy_api_structs/src/
COPY server/lemmy_rate_limit/src/ ./lemmy_rate_limit/src/ COPY lemmy_rate_limit/src/ ./lemmy_rate_limit/src/
COPY server/migrations ./migrations/ COPY migrations ./migrations/
# Build for debug # Build for debug
RUN cargo build RUN cargo build
@ -50,7 +50,7 @@ RUN apk add libpq
RUN apk add espeak RUN apk add espeak
# Copy resources # Copy resources
COPY server/config/defaults.hjson /config/defaults.hjson COPY config/defaults.hjson /config/defaults.hjson
COPY --from=rust /app/server/target/x86_64-unknown-linux-musl/debug/lemmy_server /app/lemmy COPY --from=rust /app/server/target/x86_64-unknown-linux-musl/debug/lemmy_server /app/lemmy
COPY --from=docs /app/docs/book/ /app/documentation/ COPY --from=docs /app/docs/book/ /app/documentation/

View file

@ -10,17 +10,17 @@ WORKDIR /app
RUN sudo chown -R rust:rust . RUN sudo chown -R rust:rust .
RUN USER=root cargo new server RUN USER=root cargo new server
WORKDIR /app/server WORKDIR /app/server
COPY server/Cargo.toml server/Cargo.lock ./ COPY Cargo.toml Cargo.lock ./
COPY server/lemmy_db ./lemmy_db COPY lemmy_db ./lemmy_db
COPY server/lemmy_utils ./lemmy_utils COPY lemmy_utils ./lemmy_utils
COPY server/lemmy_api_structs ./lemmy_api_structs COPY lemmy_api_structs ./lemmy_api_structs
COPY server/lemmy_rate_limit ./lemmy_rate_limit COPY lemmy_rate_limit ./lemmy_rate_limit
RUN mkdir -p ./src/bin \ RUN mkdir -p ./src/bin \
&& echo 'fn main() { println!("Dummy") }' > ./src/bin/main.rs && echo 'fn main() { println!("Dummy") }' > ./src/bin/main.rs
RUN cargo build --release RUN cargo build --release
RUN find target/$CARGO_BUILD_TARGET/$RUSTRELEASEDIR -type f -name "$(echo "lemmy_server" | tr '-' '_')*" -exec touch -t 200001010000 {} + RUN find target/$CARGO_BUILD_TARGET/$RUSTRELEASEDIR -type f -name "$(echo "lemmy_server" | tr '-' '_')*" -exec touch -t 200001010000 {} +
COPY server/src ./src/ COPY src ./src/
COPY server/migrations ./migrations/ COPY migrations ./migrations/
# build for release # build for release
# workaround for https://github.com/rust-lang/rust/issues/62896 # workaround for https://github.com/rust-lang/rust/issues/62896
@ -60,7 +60,7 @@ RUN addgroup -g 1000 lemmy
RUN adduser -D -s /bin/sh -u 1000 -G lemmy lemmy RUN adduser -D -s /bin/sh -u 1000 -G lemmy lemmy
# Copy resources # Copy resources
COPY --chown=lemmy:lemmy server/config/defaults.hjson /config/defaults.hjson COPY --chown=lemmy:lemmy config/defaults.hjson /config/defaults.hjson
COPY --chown=lemmy:lemmy --from=rust /app/server/lemmy_server /app/lemmy COPY --chown=lemmy:lemmy --from=rust /app/server/lemmy_server /app/lemmy
COPY --chown=lemmy:lemmy --from=docs /app/docs/book/ /app/dist/documentation/ COPY --chown=lemmy:lemmy --from=docs /app/docs/book/ /app/dist/documentation/
COPY --chown=lemmy:lemmy --from=node /app/ui/dist /app/dist COPY --chown=lemmy:lemmy --from=node /app/ui/dist /app/dist

View file

@ -13,8 +13,8 @@ third_semver=$(echo $new_tag | cut -d "." -f 3)
# Setting the version on the front end # Setting the version on the front end
cd ../../ cd ../../
# Setting the version on the backend # Setting the version on the backend
echo "pub const VERSION: &str = \"$new_tag\";" > "server/src/version.rs" echo "pub const VERSION: &str = \"$new_tag\";" > "src/version.rs"
git add "server/src/version.rs" git add "src/version.rs"
# Setting the version for Ansible # Setting the version for Ansible
echo $new_tag > "ansible/VERSION" echo $new_tag > "ansible/VERSION"
git add "ansible/VERSION" git add "ansible/VERSION"

View file

@ -1,7 +1,7 @@
# Configuration # Configuration
The configuration is based on the file The configuration is based on the file
[defaults.hjson](https://yerbamate.dev/LemmyNet/lemmy/src/branch/main/server/config/defaults.hjson). [defaults.hjson](https://yerbamate.dev/LemmyNet/lemmy/src/branch/main/config/defaults.hjson).
This file also contains documentation for all the available options. To override the defaults, you This file also contains documentation for all the available options. To override the defaults, you
can copy the options you want to change into your local `config.hjson` file. can copy the options you want to change into your local `config.hjson` file.

View file

@ -32,18 +32,10 @@ by the `cd` command.
### Build the backend (Rust) ### Build the backend (Rust)
``` ```
cd server
cargo build cargo build
# for development, use `cargo check` instead) # for development, use `cargo check` instead)
``` ```
### Build the frontend (Typescript)
```
cd ui
yarn
yarn build
```
### Setup postgresql ### Setup postgresql
#### Ubuntu #### Ubuntu
``` ```

2
install.sh vendored
View file

@ -29,7 +29,7 @@ ask_to_init_db() {
done done
if [ "$init_db_final" = 1 ] if [ "$init_db_final" = 1 ]
then then
source ./server/db-init.sh source ./db-init.sh
read -n 1 -s -r -p "Press ANY KEY to continue execution of this script, press CTRL+C to quit..." read -n 1 -s -r -p "Press ANY KEY to continue execution of this script, press CTRL+C to quit..."
echo echo
fi fi

View file

@ -87,7 +87,7 @@ impl Settings {
/// added to the config. /// added to the config.
/// ///
/// Note: The env var `LEMMY_DATABASE_URL` is parsed in /// Note: The env var `LEMMY_DATABASE_URL` is parsed in
/// `server/lemmy_db/src/lib.rs::get_database_url_from_env()` /// `lemmy_db/src/lib.rs::get_database_url_from_env()`
fn init() -> Result<Self, ConfigError> { fn init() -> Result<Self, ConfigError> {
let mut s = Config::new(); let mut s = Config::new();

Some files were not shown because too many files have changed in this diff Show more