{"id":21578660,"url":"https://github.com/mbaraa/rex","last_synced_at":"2025-03-18T07:32:06.692Z","repository":{"id":160751656,"uuid":"635559633","full_name":"mbaraa/rex","owner":"mbaraa","description":"Redeploy docker compose containers after git push","archived":false,"fork":false,"pushed_at":"2024-11-25T10:39:58.000Z","size":55,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-24T14:18:01.589Z","etag":null,"topics":["deployment","github-actions","go"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mbaraa.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-05-03T00:42:03.000Z","updated_at":"2024-11-25T10:40:02.000Z","dependencies_parsed_at":"2024-05-09T19:31:53.100Z","dependency_job_id":"e1effcde-6b33-4827-84ec-8ac19cc509c0","html_url":"https://github.com/mbaraa/rex","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbaraa%2Frex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbaraa%2Frex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbaraa%2Frex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbaraa%2Frex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mbaraa","download_url":"https://codeload.github.com/mbaraa/rex/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244177687,"owners_count":20411001,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["deployment","github-actions","go"],"created_at":"2024-11-24T13:11:18.614Z","updated_at":"2025-03-18T07:32:06.667Z","avatar_url":"https://github.com/mbaraa.png","language":"Go","readme":"# Rex\n\nRedeploy docker compose containers after git push\n\n### Installing the server:\n\nThis will install Rex's server which will allow deploying your app\n\n1.  You can use the latest binary release in the [releases](https://github.com/mbaraa/rex/releases)\n2.  Or if that doesn't work, compile it yourself using\n    - `go build -ldflags=\"-w -s\"`\n3.  Set the environmental variables as showm in the `.env.example`\n    - Either use flags when running the server, or set the environmental variable manually.\n    - Values' are taken from flags, if it doesn't exist it uses the corresponding environmental variable.\n\n| Flag              | Env var               | Description                                                           |\n| ----------------- | --------------------- | --------------------------------------------------------------------- |\n| `port`            | `REX_PORT_NUMBER`     | Give me a port number. (default: `7567`)                              |\n| `rex-key`         | `REX_AUTH_KEY`        | Give me a secure key to use the GitHub action with                    |\n| `repos-dir`       | `REX_REPOS_DIR`       | Give me a proper directory path where your GitHub repos are stored in |\n| `allowed-origins` | `REX_ALLOWED_ORIGINS` | give me a list of allowed origins                                     |\n| `github-username` | `REX_GITHUB_USERNAME` | Give me your GitHub username so I can pull repos' changes             |\n| `github-token`    | `REX_GITHUB_TOKEN`    | Give me your GitHub token so I can pull repos' changes                |\n\n4.  Install the systemd service, since I haven't figured out how to make this fully work in docker :(\n\n\u003c!----\u003e\n\n    # /etc/systemd/system/rex.service\n    [Unit]\n    Description=Rex\n\n    [Service]\n    Type=simple\n    User=yourusername # REMOVE THIS COMMENT; so that git will work, and the other docker stuff\n    EnvironmentFile=/path/to/rex/.env_file # REMOVE THIS COMMENT; let systemd handle parsing the environmental variables\n    WorkingDirectory=/path/to/rex/ # REMOVE THIS COMMENT; they must be in the same directory, otherwise it won't work :)\n    ExecStart=/path/to/rex/binary\n    Restart=always\n\n    [Install]\n    WantedBy=multi-user.target\n\n5. Reload systemd's daemons and start the server\n\n```bash\nsudo systemctl daemon-reload\nsudo systemctl enable --now rex\n```\n\n### Adding the GitHub action\n\nThis where the fun begins.\n\n1.  Add a [secret](https://docs.github.com/en/actions/security-guides/encrypted-secrets) to your GitHub Repo called `REX_KEY` with the same value that you've set on the server\n    - You can add the server url as a secret as well if you prefer to :)\n2.  Create the GitHub action under `.github/workflows/rex-build.yml`\n\n```yaml\njobs:\n  rex-deploy:\n    runs-on: ubuntu-latest\n    steps:\n      - name: rex-7567-e27\n        uses: mbaraa/rex-action@v1.6.3\n        with:\n          server-url: example.com\n          token: ${{ secrets.REX_KEY }}\n          repo-name: repoName\n          # commit-sha is optional :)\n          commit-sha: ${{ github.sha }}\n          # repo-tag is optional :)\n          repo-tag: ${{ github.ref }}\n```\n\n3.  Do a push and see the magic happen\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmbaraa%2Frex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmbaraa%2Frex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmbaraa%2Frex/lists"}