-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make migrations compatible with sqlite. Update the migrations for sqlite. Update javascript dependencies. Fix error with null permissions due to lack of loading the user id. Update dependencies versions in mix.exs and mix.lock Update test configurations and database settings for different DB types. Update config file to import Config module instead of using Mix.Config. Update README with test environment setup instructions Add gitignore entries, update package-lock.json, and README.md Update README with local dev setup instructions SQLite doesn't support the ILIKE operator However, you can achieve the same result using the LIKE operator in SQLite because it's case-insensitive by default. Update grammar. Update PostgreSQL references in workflow for testing Refactor workflow to include repository checkout and cargo build Update workflows to run specific tests for postgres and sqlite databases. Add exqlite as an extra application dependency. Update test result parsing and check logic Update dependency version for scrivener_ecto.
- Loading branch information
Showing
21 changed files
with
143 additions
and
102 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 |
---|---|---|
@@ -1,69 +1,101 @@ | ||
# Uro | ||
|
||
## Local Dev | ||
It's possible to run the entire stack locally with docker-compose by running `docker-compose up` | ||
|
||
It's possible to run the entire stack locally with docker-compose by running `docker-compose up` | ||
|
||
To start your Phoenix server: | ||
|
||
* Install dependencies with `mix deps.get` | ||
* Create and migrate your database with `mix ecto.setup` | ||
* Install Node.js dependencies with `cd assets && npm install` | ||
* Start Phoenix endpoint with `mix phx.server` | ||
- Install dependencies with `mix deps.get` | ||
- Create and migrate your database with `mix ecto.setup` | ||
- Install Node.js dependencies with `cd assets && npm install` | ||
- Start Phoenix endpoint with `mix phx.server` | ||
|
||
Now you can visit [`localhost:4000`](http://localhost:4000) from your browser. | ||
Now, you can visit [`localhost:4000`](http://localhost:4000) from your browser. | ||
|
||
Ready to run in production? Please [check our deployment guides](https://hexdocs.pm/phoenix/deployment.html). | ||
|
||
## Learn more | ||
|
||
* Official website: https://www.phoenixframework.org/ | ||
* Guides: https://hexdocs.pm/phoenix/overview.html | ||
* Docs: https://hexdocs.pm/phoenix | ||
* Forum: https://elixirforum.com/c/phoenix-forum | ||
* Source: https://github.com/phoenixframework/phoenix | ||
- Official website: https://www.phoenixframework.org/ | ||
- Guides: https://hexdocs.pm/phoenix/overview.html | ||
- Docs: https://hexdocs.pm/phoenix | ||
- Forum: https://elixirforum.com/c/phoenix-forum | ||
- Source: https://github.com/phoenixframework/phoenix | ||
|
||
## How to create a test environment? | ||
## How do you create a test environment? | ||
|
||
```bash | ||
cockroach start-single-node --insecure --background | ||
export MIX_ENV=dev | ||
export MIX_ENV=dev | ||
mix deps.get | ||
mix ecto.drop | ||
mix ecto.setup | ||
mix run priv/repo/test_seeds.exs | ||
iex -S mix phx.server | ||
``` | ||
|
||
Note that `bcrypt_elixir` will require a working compiler in the PATH. On a Windows system with Visual Studio, you will want to run `mix deps.compile --force` from within a "x64 Native Tools Command Prompt" or cmd with vcvarsall.bat (may fail to build the rest of uro) then return to a bash shell for the rest of the build. | ||
|
||
## How do we create a test environment for the Macos? | ||
|
||
```bash | ||
# Start in v-sekai/v-sekai-other-world | ||
cd mvsqlite | ||
cargo build --locked --release -p mvstore --manifest-path Cargo.toml | ||
export RUST_LOG=error | ||
DYLD_FALLBACK_LIBRARY_PATH=/usr/local/lib ./target/release/mvstore --data-plane 127.0.0.1:7000 --admin-api 127.0.0.1:7001 --metadata-prefix mvstore-test --raw-data-prefix m --auto-create-namespace --cluster /usr/local/etc/foundationdb/fdb.cluster & | ||
``` | ||
|
||
```bash | ||
# create database | ||
sleep 1 | ||
curl http://localhost:7001/api/create_namespace -d '{"key":"uro_dev.sqlite3","metadata":""}' | ||
sleep 1 | ||
``` | ||
|
||
``` | ||
cd SERVICE_uro_sqlite_fdb | ||
MIX_ENV=test mix ecto.setup | ||
MIX_ENV=test mix run priv/repo/test_seeds.exs | ||
MIX_ENV=test mix test | tee test_output.txt; test ${PIPESTATUS[0]} -eq 0 | ||
``` | ||
|
||
## Log into Cockroachdb sql shell | ||
|
||
`./cockroach sql --database="uro_dev" --insecure` | ||
|
||
You may approve all pending email verifications using: | ||
You may approve all pending email verifications using the following: | ||
|
||
``` | ||
```sql | ||
update users set email_confirmation_token=null, email_confirmed_at=NOW() where true; | ||
``` | ||
|
||
And you can grant upload privileges for all users using | ||
``` | ||
You can grant upload privileges to all users using | ||
|
||
```sql | ||
update user_privilege_rulesets set can_upload_avatars=true, can_upload_maps=true, can_upload_props=true where true; | ||
``` | ||
|
||
Finally, to enable admin access for a specific user id: | ||
``` | ||
Finally, to enable admin access for a specific user ID: | ||
|
||
```sql | ||
update user_privilege_rulesets set is_admin=true where user_id = '12345678-abcd-...'; | ||
``` | ||
|
||
## Host local CDN for testing | ||
|
||
By default, the `dev` environment will store assets in `priv/waffle/private` directory, and the client expects this to be available on port 80. To serve the CDN content on port 80: | ||
|
||
``` | ||
```bash | ||
cd priv/waffle/private | ||
python -m http.server 80 | ||
``` | ||
|
||
Windows allows any user to serve port 80 by default, but on other operating systems the above should be run with sudo. | ||
Windows allows any user to serve port 80 by default, but the above should be run with sudo on other operating systems. | ||
|
||
# Mvsqlite | ||
|
||
``` | ||
UPDATE users SET email_confirmation_token = NULL, email_confirmed_at = datetime('now') WHERE 1; | ||
``` |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
defmodule Uro.Repo do | ||
use Ecto.Repo, | ||
otp_app: :uro, | ||
adapter: Ecto.Adapters.Postgres | ||
adapter: Ecto.Adapters.SQLite3 | ||
|
||
use Scrivener, page_size: 10 | ||
end |
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
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
Oops, something went wrong.